"selectionProps" and "disabled" not working - material-table
upasanadeka opened this issue · comments
I'm using material-table, and I want to use selectionProps for disabling certain rows conditionally. However, it doesn't seem to work.
I installed material-table using npm via the official documentation.
let data = [
{
"module_id": 7005,
"rule_id": 12,
"id": 0
},
{
"module_id": 7005,
"rule_id": 12,
"parentId": 0,
"id": 1
},
{
"module_id": 7005,
"rule_id": 12,
"parentId": 0,
"id": 2
},
{
"module_id": 7005,
"rule_id": 16,
"parentId": 0,
"id": 3
}
]
<MaterialTable icons={tableIcons} title="Staging Table" columns={columns} data={data} options={{ headerStyle: { backgroundColor: "#d96f24", //'#039be5', color: "#FFF", textAlign: "center", whiteSpace: "nowrap", fontSize: 15, height: "2em", textTransform: "uppercase", fontWeight: "bold", textAlign: "center", }, paging: true, pageSize: 100, emptyRowsWhenPaging: false, pageSizeOptions: [100, 200, 300], // selection: props.accessName.includes(admin) ? true : false, selection: true, selectionProps: rowData => ({ disabled: rowData.id === 1, }), rowStyle: rowData => ({ backgroundColor: rowData.tableData.checked ? '#f8cbaa' : '', whiteSpace: "nowrap" }), }} // parentChildData={(row, rows) => rows.find(a => a.id === row.parentId)} onSelectionChange={(data) => handleSelection(data)} />
Also checked the index.d.ts file for MaterialTableProps and it doesn't seem to include selectionProps anymore.
Is there any other way to implement this?
- OS: Windows 10
- Browser Microsoft Edge/Chrome
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.