Why are react-table pagination and filter reset when its (the react-table) data changes?

Viewed 711

I added 4 custom columns to my table columns list using its Cell property; each of these columns in every row contains a checkbox that changes a specific property in the table's data state; its data state structure is something like so:

export type dataTypes = {
    id: number;
    getAccess: boolean;
    insertAccess: boolean;
    editAccess: boolean;
    deleteAccess: boolean;
}[];

I don't want react-table pagination to reset to its first page when the table's data state is modified by the checkboxes (also about the table's filter).

Does anyone know about it?

1 Answers

I solved this problem by adding autoResetPage: false and autoResetFilters: false to useTable hook like so:

    const tableInstance = useTable({
        columns,
        data,
        autoResetPage: false,
        autoResetFilters: false
    }, usePagination)

Related