Would it be possible to make the row data object available on a rowEvent?
const rowEvents = {
onClick: (event, row) => {
console.log(`row ${row.id} was clicked.` )
}
};
This would really help to avoid passing data as data-attributes down to the dom and then reading them through the event data.
Alternatively, i can also think of adding a flag to selectRow.onSelect that indicates whether the row was selected/deselected via the radio/checkbox or via click on row.
this should only be available when the clickToSelect is enabled. an example could be:
const selectRow = {
mode: 'checkbox',
clickToSelect: true
onSelect: (row, isSelect, rowIndex, rowClick) => {
if(rowClick) // redirect to row.href
else // default (select row)
}
};
@Sathras sure, I'll consider to add this feature :) . thanks!!
Created PR and added storybook example: #187
For this:
Alternatively, i can also think of adding a flag to selectRow.onSelect that indicates whether the row was selected/deselected via the radio/checkbox or via click on row.
I think we already have the isSelect parameter. It will always remain true for single(radio) selection and for multiple(checkbox) selection will be true or false if selected or deselected respectively.
Thanks.
@Sathras Hi, I have a quick question. if I understand correctly, without the feature you requested, there is no way to handle the row object with rowEvents right? For me, when I investigate 'e' parameter, it does not give me any productive data related to the selected row object
Thanks a lot, :)
@AllenFang BTW, is this already supported? Thank you
Also requesting this feature :)
I also just ran into this. Cannot really use the component if I cannot do an action on the clicked row. Any workarounds?
Hey all, this feature will be released in next week(2/14), thanks
New Release: https://react-bootstrap-table.github.io/react-bootstrap-table2/blog/2018/02/14/version-bump.html
For this issue, check this > https://github.com/react-bootstrap-table/react-bootstrap-table2/blob/master/packages/react-bootstrap-table2-example/examples/rows/row-event.js#L23
Let me know if the problem still remain, thanks
Thanks a lot, Allen! Fantastic job!
Most helpful comment
@Sathras sure, I'll consider to add this feature :) . thanks!!