How to save and restore filter state of datatable

UI Components for React
Post Reply
ssaha
Posts: 7
Joined: 04 Nov 2022, 10:06

05 Jan 2023, 19:51

May I know, how we can save and restore filter state of datatable ?

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

05 Jan 2023, 21:11

There is an example of saving and restoring state: https://primefaces.org/primereact/datatable/state/
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

ssaha
Posts: 7
Joined: 04 Nov 2022, 10:06

06 Jan 2023, 10:05

Thanks !!!
May I know, how to reset the sorting in datatable on button click or any action ?

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

07 Jan 2023, 00:34

yep there is a "datatableRef.current?.reset()` method.

Available methods on Datatable..

Code: Select all

 public clearState(): void;
    public closeEditingCell(): void;
    public exportCSV(options?: { selectionOnly: boolean }): void;
    public filter<T>(value: T, field: string, mode: DataTableFilterMatchModeType, index?: number): void;
    public reset(): void;
    public resetColumnOrder(): void;
    public resetScroll(): void;
    public restoreColumnWidths(): void;
    public restoreState(): void;
    public restoreTableState(state: any): void;
    public saveState(): void;
    public getElement(): HTMLDivElement;
    public getTable(): HTMLTableElement;
    public getVirtualScroller(): VirtualScroller;
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests