replaced subPage with page (#6438)
On mass select operation in table widget, Now all rows are selected.
This commit is contained in:
parent
38e1d660ef
commit
45cfb0b0f1
|
|
@ -182,22 +182,22 @@ export function Table(props: TableProps) {
|
|||
// return : 0; no row selected | 1; all row selected | 2: some rows selected
|
||||
if (!props.multiRowSelection) return null;
|
||||
const selectedRowCount = reduce(
|
||||
subPage,
|
||||
page,
|
||||
(count, row) => {
|
||||
return selectedRowIndices.includes(row.index) ? count + 1 : count;
|
||||
},
|
||||
0,
|
||||
);
|
||||
const result =
|
||||
selectedRowCount === 0 ? 0 : selectedRowCount === subPage.length ? 1 : 2;
|
||||
selectedRowCount === 0 ? 0 : selectedRowCount === page.length ? 1 : 2;
|
||||
return result;
|
||||
}, [selectedRowIndices, subPage]);
|
||||
}, [selectedRowIndices, page]);
|
||||
const handleAllRowSelectClick = (
|
||||
e: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
||||
) => {
|
||||
// if all / some rows are selected we remove selection on click
|
||||
// else select all rows
|
||||
props.toggleAllRowSelect(!Boolean(rowSelectionState), subPage);
|
||||
props.toggleAllRowSelect(!Boolean(rowSelectionState), page);
|
||||
// loop over subPage rows and toggleRowSelected if required
|
||||
e.stopPropagation();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user