Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(table): allow custom attributes in table td cell #1193

Merged
merged 1 commit into from Oct 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
| `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)
| `tdAttr` | Object | JavaScript object representing additional attributes to apply to the `td` cell

**Notes:**
- _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">
<td v-if="$scopedSlots[field.key]"
:class="tdClasses(field, item)"
:key="field.key">
:key="field.key"
v-bind="field.tdAttr">
<slot :name="field.key"
:value="getFormattedValue(item, field)"
:unformatted="item[field.key]"
Expand All @@ -85,6 +86,7 @@
:class="tdClasses(field, item)"
:key="field.key"
v-html="getFormattedValue(item, field)"
v-bind="field.tdAttr"
></td>
</template>
</tr>
Expand Down