You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(b-table, b-table-lite): new tbody-tr-attr prop for arbitrary row attributes (closes#1864) (#4481)
* feat(b-table): add custom row attributes
Adds a trAttr attribute to b-table, which can either be an object or a function
An object is added straight to the attributes of each row
A function gets passed each item and is expected to return an object
* Change attribute order so ARIA attributes don't get overwritten
* Add implementation version to package declaration
* Add implementation version to package declaration
Missed second one...
* Update mixin-tbody-row.js
* Update mixin-busy.js
* Update mixin-bottom-row.js
* Update mixin-empty.js
* Update mixin-top-row.js
* Update package.json
* Update index.d.ts
* Update README.md
* lint
* Update index.d.ts
* Update mixin-tbody-row.js
|`tbodyTrClass`| String, Array or Function | Classes to be applied to every row on the table. If a function is given, it will be called as `tbodyTrClass( item, type )` and it may return an `Array`, `Object` or `String`. |
|`tbody-tr-class`| String, Array or Function | Classes to be applied to every row on the table. If a function is given, it will be called as `tbodyTrClass( item, type )` and it may return an `Array`, `Object` or `String`. |
457
+
|`tbody-tr-attr`| Object or Function | Attributes to be applied to every row on the table. If a function is given, it will be called as `tbodyTrAttr( item, type )` and it must return an `Object`. |
456
458
457
-
When passing a function reference to `tbody-tr-class`, the function's arguments will be as follows:
459
+
When passing a function reference to `tbody-tr-class` or `tbody-tr-attr`, the function's arguments
460
+
will be as follows:
458
461
459
462
-`item` - The item record data associated with the row. For rows that are not associated with an
460
463
item record, this value will be `null` or `undefined`
@@ -485,7 +488,7 @@ When passing a function reference to `tbody-tr-class`, the function's arguments
485
488
},
486
489
methods: {
487
490
rowClass(item, type) {
488
-
if (!item) return
491
+
if (!item|| type !=='row') return
489
492
if (item.status==='awesome') return'table-success'
0 commit comments