Handles pagination state using browser history state.

  • Type Parameters

    • FilterData extends {} = any

      The type of filter data for the query.

    • RowData extends IRowData = any

      The type of row data for the query.

    Parameters

    • history: any

      The history object from react-router.

    • Optionaloptions: Partial<IParams<FilterData, RowData>>

      Optional parameters for configuring the pagination.

      • initialValue

        The initial query value.

      • onFilterChange

        The callback function when filter data changes.

      • onLimitChange

        The callback function when limit changes.

      • onPageChange

        The callback function when page changes.

      • onSortModelChange

        The callback function when sort model changes.

      • onChipsChange

        The callback function when chip data changes.

      • onSearchChange

        The callback function when search changes.

      • onChange

        The callback function when the state changes.

      • removeEmptyFilters

        Indicates whether to remove empty filters from the query.

      • fallback

        The fallback component to render when the query is not available.

    Returns {
        getChipData: () => Exclude<
            Partial<Record<keyof RowData, boolean>>,
            undefined,
        >;
        getFilterData: () => Exclude<Partial<FilterData>, undefined>;
        getLimit: () => number;
        getPage: () => number;
        getSearch: () => string;
        getSortModel: () => ListHandlerSortModel<RowData>;
        listProps: {
            chipData: undefined | Partial<Record<keyof RowData, boolean>>;
            fallback?: (e: Error) => void;
            filterData: undefined | Partial<FilterData>;
            limit: undefined | number;
            onChipsChange: (data: Partial<Record<keyof RowData, boolean>>) => void;
            onFilterChange: (data: FilterData) => void;
            onLimitChange: (limit: number) => void;
            onPageChange: (page: number) => void;
            onSearchChange: (search: string) => void;
            onSortModelChange: (sort: any) => void;
            page: undefined | number;
            search: undefined | string;
            sortModel: any;
        };
        setChipData: (data: Partial<Record<keyof RowData, boolean>>) => void;
        setFilterData: (data: FilterData) => void;
        setLimit: (limit: number) => void;
        setPage: (page: number) => void;
        setSearch: (search: string) => void;
        setSortModel: (sort: any) => void;
    }

    • An object containing the pagination state and methods.