Permalink
Browse files

feat(table): Pass computed fields array to details scoped slot (#1271)

* feat(table): Pass computedFields to row details slot

* Update README.md
  • Loading branch information...
tmorehouse committed Oct 31, 2017
1 parent aff1825 commit 0745ae8a567c5a218c26c57fc89d8804d6da476c
Showing with 7 additions and 4 deletions.
  1. +5 −3 src/components/table/README.md
  2. +2 −1 src/components/table/table.vue
@@ -116,8 +116,8 @@ each item (record) row, and to provide additional fetures such as enabling
[**sorting**](#sorting) on the column, etc.
Fields can be provided as a _simple array_, an _array of objects_, or an
_object_. Internally the fields data will be normalized into the _array of
objects_ format. Events or slots that include the column `field` data will be
_object_. **Internally the fields data will be normalized into the _array of
objects_ format**. Events or slots that include the column `field` data will be
in the normalized field object format (array of objects for `fields`, or an
object for an individual `field`).
@@ -690,14 +690,16 @@ scoped slot exists, a new row will be shown just below the item, with the conten
of the scoped slot.
**Note:** the `_showDetails` property **must** exist in the items data for proper
reactive detection of changes in `_showDetails`.
reactive detection of changes in `_showDetails`. Read more about
[Vue ractivity limitations](https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats).
Available scoped variables:
| Property | Description
| -------- | -----------
| `item` | The entire row record data object
| `index` | The current visible row number
| `fields` | The normailized fields definition array
```html
<template>
@@ -91,9 +91,10 @@
</template>
</tr>
<tr v-if="item._showDetails && $scopedSlots['row-details']"
class="b-table-details"
:key="`${index}-details`">
<td :colspan="computedFields.length">
<slot name="row-details" :item="item" :index="index"></slot>
<slot name="row-details" :item="item" :index="index" :fields="computedFields"></slot>
</td>
</tr>
</template>

0 comments on commit 0745ae8

Please sign in to comment.