Skip to content

Commit

Permalink
Fix checkbox selection is keeping selection when filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
g1mishra committed Jan 19, 2024
1 parent c710c86 commit 6b1f42e
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import {
} from './gridRowSelectionSelector';
import { gridPaginatedVisibleSortedGridRowIdsSelector } from '../pagination';
import { gridFocusCellSelector } from '../focus/gridFocusStateSelector';
import { gridExpandedSortedRowIdsSelector } from '../filter/gridFilterSelector';
import {
gridExpandedSortedRowIdsSelector,
gridFilterModelSelector,
} from '../filter/gridFilterSelector';
import { GRID_CHECKBOX_SELECTION_COL_DEF, GRID_ACTIONS_COLUMN_TYPE } from '../../../colDef';
import { GridCellModes } from '../../../models/gridEditRowModel';
import { isKeyboardEvent, isNavigationKey } from '../../../utils/keyboardUtils';
Expand Down Expand Up @@ -445,7 +448,9 @@ export const useGridRowSelection = (
? gridPaginatedVisibleSortedGridRowIdsSelector(apiRef)
: gridExpandedSortedRowIdsSelector(apiRef);

apiRef.current.selectRows(rowsToBeSelected, params.value);
const filterModel = gridFilterModelSelector(apiRef);

apiRef.current.selectRows(rowsToBeSelected, params.value, filterModel?.items.length > 0);
},
[apiRef, props.checkboxSelectionVisibleOnly, props.pagination],
);
Expand Down

0 comments on commit 6b1f42e

Please sign in to comment.