Action "DeselectAllFilteredRows" and "DeselectAllVisibleRows" works the same
Closed this issue · 2 comments
MeTh0s commented
Both actions deselect visible selected rows, but as far as I understand "DeselectAllFilteredRows" action must deselect hidden rows.
Example:
ka-table@8.3.2
import React, { useEffect, useState } from 'react';
import { ITableProps, kaReducer, Table } from 'ka-table';
import { DataType, FilteringMode } from 'ka-table/enums';
import { DispatchFunc } from 'ka-table/types';
import {
deselectAllFilteredRows,
updateFilterRowValue,
} from 'ka-table/actionCreators';
const dataArray = Array(10)
.fill(undefined)
.map((_, index) => ({
column1: `column:1 row:${index}`,
id: index,
}));
const tablePropsInit: ITableProps = {
columns: [{ key: 'column1', title: 'Column 1', dataType: DataType.String }],
data: dataArray,
filteringMode: FilteringMode.FilterRow,
rowKeyField: 'id',
selectedRows: [0, 1, 2],
singleAction: updateFilterRowValue('column1', 'row:1'), // after action will be shown row "column:1 row:1"
};
const PotentialBugDemo: React.FC = () => {
const [tableProps, changeTableProps] = useState(tablePropsInit);
const dispatch: DispatchFunc = (action) => {
changeTableProps((prevState: ITableProps) => kaReducer(prevState, action));
};
useEffect(() => {
setTimeout(() => dispatch(deselectAllFilteredRows()), 1000); // selectedRows: [0, 2],
}, []);
return <Table {...tableProps} dispatch={dispatch} />;
};
export default PotentialBugDemo;
komarovalexander commented
Hi @MeTh0s looks like DeselectAllFilteredRows
name gave you some confusion: it deselects all rows which is shown after filtering was applied. It is almost the same with DeselectAllVisibleRows
but DeselectAllVisibleRows
also includes pagination and deselects only visible page
MeTh0s commented
ah, I got it, thanks!