Skip to content

Commit

Permalink
[DataGrid] Fix select all checkbox state reset with server side data (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi authored Dec 30, 2024
1 parent 61346b3 commit 89215a1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@ const GridHeaderCheckbox = forwardRef<HTMLButtonElement, GridColumnHeaderParams>
}

return selection.filter((id) => {
if (rootProps.keepNonExistentRowsSelected) {
return true;
}
// The row might have been deleted
if (!apiRef.current.getRow(id)) {
return false;
}

return rootProps.isRowSelectable!(apiRef.current.getRowParams(id));
});
}, [apiRef, rootProps.isRowSelectable, selection]);
}, [apiRef, rootProps.isRowSelectable, selection, rootProps.keepNonExistentRowsSelected]);

// All the rows that could be selected / unselected by toggling this checkbox
const selectionCandidates = React.useMemo(() => {
Expand Down

0 comments on commit 89215a1

Please sign in to comment.