Is your feature request related to a problem? Please describe.
The project lacks support for a mechanism for preselection, e.g. when the table is used as a selection component and loads available items from an API endpoint, some of which may have already been selected; then, the only way to skip the already selected elements from being shown as unselected (without the checkbox ticked) is to filter them out from the data array, so that they are not shown at all.
Describe the solution you'd like
The project should implement a property either on the table component or within the data prop that would allow to mark some of the rows as already selected
Hi @artus9033,
I may add a new field to response of promise to preselect, filter etc on some rows. This is good idea. I will do this asap.
@mbrn, thank you!
Any update on this feature?
@artus9033 have found a way to preselect the data. For each row the table reads from the tableData attribute on the row data.
const data = [{
...
tableData: {
checked: true
}
}]
We can control checked status like this:
Hi @gmumdzhiev ,
Can you try this:
options={{ selection: true, selectionProps: rowData => ({ checked: rowData.name === "Mehmet", onClick: (event , rowData) => this.handleCheckboxClick(event,rowData), }) }}
found here https://github.com/mbrn/material-table/issues/1356
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
Most helpful comment
@artus9033 have found a way to preselect the data. For each row the table reads from the tableData attribute on the row data.