Fix mui-grid issue after update
This commit is contained in:
@ -133,7 +133,7 @@ function InboxTable(p: {
|
||||
}, [p.entries, labelFilter]);
|
||||
|
||||
const [rowSelectionModel, setRowSelectionModel] =
|
||||
React.useState<GridRowSelectionModel>([]);
|
||||
React.useState<GridRowSelectionModel>({ type: "include", ids: new Set() });
|
||||
|
||||
const [attaching, setAttaching] = React.useState<InboxEntry | undefined>();
|
||||
|
||||
@ -244,7 +244,7 @@ function InboxTable(p: {
|
||||
|
||||
// Find the entry to map
|
||||
const entries = p.entries.filter(
|
||||
(m) => rowSelectionModel.includes(m.id) && !m.movement_id
|
||||
(m) => rowSelectionModel.ids.has(m.id) && !m.movement_id
|
||||
);
|
||||
const movements: Movement[][] = [];
|
||||
|
||||
@ -324,7 +324,7 @@ function InboxTable(p: {
|
||||
const deleteMultiple = async () => {
|
||||
try {
|
||||
const deletedEntries = p.entries.filter((m) =>
|
||||
rowSelectionModel.includes(m.id)
|
||||
rowSelectionModel.ids.has(m.id)
|
||||
);
|
||||
|
||||
if (
|
||||
@ -437,7 +437,9 @@ function InboxTable(p: {
|
||||
icon={<SearchIcon />}
|
||||
label="Attach entry to movement"
|
||||
color="inherit"
|
||||
onClick={() => { handleAttachClick(params.row); }}
|
||||
onClick={() => {
|
||||
handleAttachClick(params.row);
|
||||
}}
|
||||
disabled={!!params.row.movement_id}
|
||||
/>
|
||||
</Tooltip>,
|
||||
@ -496,7 +498,7 @@ function InboxTable(p: {
|
||||
</Tooltip>
|
||||
<Tooltip title="Attach all the selected inbox entries to movements">
|
||||
<IconButton
|
||||
disabled={rowSelectionModel.length === 0}
|
||||
disabled={rowSelectionModel.ids.size === 0}
|
||||
onClick={attachMultiple}
|
||||
>
|
||||
<SearchIcon />
|
||||
@ -505,8 +507,8 @@ function InboxTable(p: {
|
||||
<Tooltip title="Delete all the selected inbox entries">
|
||||
<IconButton
|
||||
disabled={
|
||||
rowSelectionModel.length === 0 ||
|
||||
rowSelectionModel.length === p.entries.length
|
||||
rowSelectionModel.ids.size === 0 ||
|
||||
rowSelectionModel.ids.size === p.entries.length
|
||||
}
|
||||
onClick={deleteMultiple}
|
||||
>
|
||||
|
Reference in New Issue
Block a user