Is column/cell exclusion of @row-clicked event on b-table possible ?
See original GitHub issueHi everyone,
I have a b-table
(to display a list of records of course) in which I use the @row-clicked
event to open the form view of the clicked record.
I also use a column with b-form-checkbox
to be able to select several lines (because selectable
prop can’t be used aside of my event since my event switches to another component).
The thing is the checkbox is quite small and sometimes when I want to tick it I click outside of it, so on the row, and it triggers my event.
It would be very great to have a way to say : exclude these columns (for instance here the one with the checkboxes and the Actions column)
Since we have a way to define fields in a b-table with :fields
, that I use like this :
table_fields: [
{ key: 'selected' },
{ key: 'username', sortable: true },
{ key: 'firstName', sortable: true },
{ key: 'lastName', sortable: true },
{ key: 'groupIds', label: 'Groups' },
{ key: 'isActive', sortable: true, label: 'Status' },
{ key: 'actions', label: 'Actions' }
],
Would it be possible to implement a prop (like sortable
) like exclude-from-rowclick
or something like that ?
That would end up with something like :
table_fields: [
{ key: 'selected', exclude-from-rowclick: true },
{ key: 'username', sortable: true },
{ key: 'firstName', sortable: true },
{ key: 'lastName', sortable: true },
{ key: 'groupIds', label: 'Groups' },
{ key: 'isActive', sortable: true, label: 'Status' },
{ key: 'actions', label: 'Actions', exclude-from-rowclick: true }
],
Maybe that already exists ? But I didn’t find it.
Thanks for your help.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top GitHub Comments
That’s pretty much exactly what i did in the codepen i posted above
Here’s a codepen with a working example of what you could do to get this behavior.
By filling the cell with a div that has
@click.stop
, clicking the div wont trigger the@row-clicked
event, while leaving the checkbox as is.https://codepen.io/Hiws/pen/eYNWLEb