Skip to content

Commit

Permalink
feat(table): Allow custom attributes in table td cell (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-walton authored and tmorehouse committed Oct 12, 2017
1 parent 69ed057 commit 485adbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/components/table/README.md
Expand Up @@ -256,6 +256,7 @@ The following field properties are recognized:
| `thClass` | String or Array | Class name (or array of class names) to add to header/footer `<th>` cell | `thClass` | String or Array | Class name (or array of class names) to add to header/footer `<th>` cell
| `thStyle` | Object | JavaScript object representing CSS styles you would like to apply to the table field `<th>` | `thStyle` | Object | JavaScript object representing CSS styles you would like to apply to the table field `<th>`
| `variant` | String | Apply contextual class to the `<th>` **and** `<td>` in the column - `active`, `success`, `info`, `warning`, `danger` (these variants map to classes `thead-${variant}`, `table-${variant}`, or `bg-${variant}` accordingly) | `variant` | String | Apply contextual class to the `<th>` **and** `<td>` in the column - `active`, `success`, `info`, `warning`, `danger` (these variants map to classes `thead-${variant}`, `table-${variant}`, or `bg-${variant}` accordingly)
| `tdAttr` | Object | JavaScript object representing additional attributes to apply to the `td` cell


**Notes:** **Notes:**
- _Field properties, if not present, default to `null` unless otherwise stated above._ - _Field properties, if not present, default to `null` unless otherwise stated above._
Expand Down
4 changes: 3 additions & 1 deletion lib/components/table.vue
Expand Up @@ -73,7 +73,8 @@
<template v-for="field in computedFields"> <template v-for="field in computedFields">
<td v-if="$scopedSlots[field.key]" <td v-if="$scopedSlots[field.key]"
:class="tdClasses(field, item)" :class="tdClasses(field, item)"
:key="field.key"> :key="field.key"
v-bind="field.tdAttr">
<slot :name="field.key" <slot :name="field.key"
:value="getFormattedValue(item, field)" :value="getFormattedValue(item, field)"
:unformatted="item[field.key]" :unformatted="item[field.key]"
Expand All @@ -85,6 +86,7 @@
:class="tdClasses(field, item)" :class="tdClasses(field, item)"
:key="field.key" :key="field.key"
v-html="getFormattedValue(item, field)" v-html="getFormattedValue(item, field)"
v-bind="field.tdAttr"
></td> ></td>
</template> </template>
</tr> </tr>
Expand Down

0 comments on commit 485adbf

Please sign in to comment.