[x] Considered the value versus complexity for all users of the library as well as library maintenance
[x] Considered if this can be a storybook or documentation example
Is your feature request related to a problem? Please describe
Currently the only way to select a row is to click the checkbox. If there's no "expand" functionality or other click-based interactivity in the entire row, I would like to have the ability to click
It is also crucial that if some parts of the row has click interactivity (for example buttons or links), all other parts without click interactivity would still select the row when clicked. So event propagation should be handled properly.
Describe the solution you'd like
selectOnRowClicked and selectOnRowDoubleClicked booleans on the DataTable component as a prop, will be good to have.
If both selectOnRowClicked and expandOnRowClicked are true, prioritize expansion.
Describe alternatives you've considered
I considered using the onRowClicked handler, but not sure how to programmatically select the clicked row. I suppose you could have a selected boolean prop in the data which is toggled by the handler, forcing the component to re-render (using selectableRowSelected). But this is clunky and also needs onSelectedRowsChange to do the same thing as well (I think). Clunky solution that might work.
As an alternative, consider enhancing the checkbox column so that a click anywhere in the cell will select the row. This makes it easier to click, because you don't have to click directly inside the checkbox. (I can't do this myself though.)
Feature Check list
Is your feature request related to a problem? Please describe
Currently the only way to select a row is to click the checkbox. If there's no "expand" functionality or other click-based interactivity in the entire row, I would like to have the ability to click
It is also crucial that if some parts of the row has click interactivity (for example buttons or links), all other parts without click interactivity would still select the row when clicked. So event propagation should be handled properly.
Describe the solution you'd like
selectOnRowClicked
andselectOnRowDoubleClicked
booleans on the DataTable component as a prop, will be good to have.If both
selectOnRowClicked
andexpandOnRowClicked
are true, prioritize expansion.Describe alternatives you've considered
I considered using the
onRowClicked
handler, but not sure how to programmatically select the clicked row. I suppose you could have aselected
boolean prop in thedata
which is toggled by the handler, forcing the component to re-render (usingselectableRowSelected
). But this is clunky and also needsonSelectedRowsChange
to do the same thing as well (I think). Clunky solution that might work.As an alternative, consider enhancing the checkbox column so that a click anywhere in the cell will select the row. This makes it easier to click, because you don't have to click directly inside the checkbox. (I can't do this myself though.)
Additional context
Already checked #213