diff --git a/src/components/table/README.md b/src/components/table/README.md index f5f4fca37f4..a3ce4c54fc7 100755 --- a/src/components/table/README.md +++ b/src/components/table/README.md @@ -264,7 +264,7 @@ The following field properties are recognized: | Property | Type | Description | ---------| ---- | ----------- | `key` | String | The key for selecting data from the record in the items array. Required when passing the props `fields` an array of objects. -| `label` | String | Appears in the columns table header (and footer if `foot-clone` is set). Defaults to the field's key (in humanized format) if not provided. +| `label` | String | Appears in the columns table header (and footer if `foot-clone` is set). Defaults to the field's key (in humanized format) if not provided. It's possible to use empty labels by assigning an empty string `""` | `class` | String or Array | Class name (or array of class names) to add to `` **and** `` in the column. | `formatter` | String or Function | A formatter callback function, can be used instead of (or in conjunction with) slots for real table fields (i.e. fields, that have corresponding data at items array). Refer to [**Custom Data Rendering**](#custom-data-rendering) for more details. | `sortable` | Boolean | Enable sorting on this column. Refer to the [**Sorting**](#sorting) Section for more details. diff --git a/src/components/table/table.js b/src/components/table/table.js index b0183d0c9ac..bfe804c2fd5 100644 --- a/src/components/table/table.js +++ b/src/components/table/table.js @@ -1,5 +1,4 @@ import startCase from 'lodash.startcase' - import looseEqual from '../../utils/loose-equal' import stableSort from '../../utils/stable-sort' import KeyCodes from '../../utils/key-codes' @@ -763,12 +762,12 @@ export default { fields.push({ key: k, label: startCase(k) }) }) } - // Ensure we have a unique array of fields and that they have labels + // Ensure we have a unique array of fields and that they have String labels const memo = {} return fields.filter(f => { if (!memo[f.key]) { memo[f.key] = true - f.label = f.label || startCase(f.key) + f.label = typeof f.label === 'string' ? f.label : startCase(f.key) return true } return false