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

Add a _trClass and / or _trAttr property to <b-table> items #1864

Closed

Comments

@kbirk
Copy link

kbirk commented Jun 1, 2018

Currently there are the tdClass and tdAttr properties for the table fields. It would be really nice to have something similar for the table items. Such as _trClass or _trAttr per item which would be injected in each row in the table.

My use case requires injecting a row-unique value into each row's DOM element to interface with another 3rd party library. This row-unique value is not displayed in the table so I can't acheive this in a roundabout way using the existing tdClass / tdAttr callback functions.

@tmorehouse
Copy link
Member

Use the table primary-key option to enable a unique ID per row, which is based on the table's ID and the value of the field that is specified by the primary-key. The primary key field needs to exist in your data, but doesn't need to be displayed in the table itself.

@jacobmllr95 jacobmllr95 changed the title Add a _trClass and / or _trAttr property to table items. Add a _trClass and / or _trAttr property to <b-table> items Apr 9, 2019
jacobmllr95 pushed a commit that referenced this issue Dec 10, 2019
…ow 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
@tmorehouse
Copy link
Member

BootstrapVue v2.2.0 has been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment