Skip to content

Commit 68b4437

Browse files
committed
fix(admin): select all checkbox not working in booking list and user list
1 parent fe60d37 commit 68b4437

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

admin/src/components/BookingList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
GridPaginationModel,
66
GridColDef,
77
GridRowId,
8-
GridRenderCellParams
8+
GridRenderCellParams,
9+
GridRowSelectionModel
910
} from '@mui/x-data-grid'
1011
import {
1112
Tooltip,
@@ -635,6 +636,9 @@ const BookingList = ({
635636
paginationModel={paginationModel}
636637
onPaginationModelChange={setPaginationModel}
637638
onRowSelectionModelChange={(_selectedIds) => {
639+
if(_selectedIds.type === 'exclude' && _selectedIds.ids.size === 0){
640+
_selectedIds = { type: 'include', ids: new Set(rows.map((row) => row._id as GridRowId)) }
641+
}
638642
setSelectedIds(Array.from(new Set(_selectedIds.ids)).map((id) => id.toString()))
639643
}}
640644
disableRowSelectionOnClick

admin/src/components/UserList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
DataGrid,
55
GridColDef,
66
GridRenderCellParams,
7+
GridRowId,
78
} from '@mui/x-data-grid'
89
import {
910
Tooltip,
@@ -371,6 +372,9 @@ const UserList = ({
371372
paginationModel={paginationModel}
372373
onPaginationModelChange={setPaginationModel}
373374
onRowSelectionModelChange={(_selectedIds) => {
375+
if (_selectedIds.type === 'exclude' && _selectedIds.ids.size === 0) {
376+
_selectedIds = { type: 'include', ids: new Set(rows.map((row) => row._id as GridRowId)) }
377+
}
374378
setSelectedIds(Array.from(new Set(_selectedIds.ids)).map((id) => id.toString()))
375379
setReloadColumns(true)
376380
}}

0 commit comments

Comments
 (0)