I have a delete function where it deletes an item however it doesn't unselect the item when is deleted and it won't disappear unless I manually unselect/uncheck it.
Is there a way to remove selection via code ? I tried the following from an answer but it didn't work for me:
DataGrid.UnselectAllCells()
This is what I have:
Inside my DataGrid:
checkboxSelection
onSelectionModelChange = {(id) => {
setSelectionModel(id);
const selectedIDs = new Set(id);
const selectedRowData = librosData.filter((row) =>
selectedIDs.has(row.id)
);
}
OnClick for delete item
onClick={() => {
const selectedIDs = new Set(selectionModel);
librosData.filter((x) =>
selectedIDs.has(x.id)).map( x => {
... Some code that deletes and update to firebase (working)
DataGrid.UnselectAllCells()
})
}}