Skip to content

Commit 89215a1

Browse files
authored
[DataGrid] Fix select all checkbox state reset with server side data (mui#16034)
1 parent 61346b3 commit 89215a1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/x-data-grid/src/components/columnSelection/GridHeaderCheckbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,17 @@ const GridHeaderCheckbox = forwardRef<HTMLButtonElement, GridColumnHeaderParams>
5050
}
5151

5252
return selection.filter((id) => {
53+
if (rootProps.keepNonExistentRowsSelected) {
54+
return true;
55+
}
5356
// The row might have been deleted
5457
if (!apiRef.current.getRow(id)) {
5558
return false;
5659
}
5760

5861
return rootProps.isRowSelectable!(apiRef.current.getRowParams(id));
5962
});
60-
}, [apiRef, rootProps.isRowSelectable, selection]);
63+
}, [apiRef, rootProps.isRowSelectable, selection, rootProps.keepNonExistentRowsSelected]);
6164

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

0 commit comments

Comments
 (0)