A hook that provides pagination functionality for querying data.

  • Type Parameters

    • FilterData extends {} = any

      The type of filter data.

    • RowData extends IRowData = any

      The type of row data.

    Parameters

    • OptionalinitialValue: Partial<IQuery<FilterData, RowData>>

      The initial value for the query.

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

      The options for the hook.

      • onFilterChange

        The callback function to handle filter data changes.

      • onLimitChange

        The callback function to handle limit changes.

      • onPageChange

        The callback function to handle page changes.

      • onSortModelChange

        The callback function to handle sort model changes.

      • onChipsChange

        The callback function to handle chip data changes.

      • onSearchChange

        The callback function to handle search changes.

      • onChange

        The callback function to handle state changes.

      • removeEmptyFilters

        The function to remove empty filters.

      • fallback

        The fallback options.

      • prefix

        The prefix for searchstate

      • noCleanupOnLeave

        The cleanup flag if changing location

      • noCleanupExtra

        The cleanup flag if remove extra query params

    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 props and methods.