We are trying to get the stateStorage and stateKey which are primeng tables but this is not working for us at all.
We have followed the guidelines outlined here - https://primefaces.org/primeng/showcase/#/table/state. This example works as you can see the keys written to the storage.
Please help as we need to keep this and other proporties of the grid (e.g. number of rows) in user personalisation.
<p-table #dataTable [value]="primengTableHelper.records" rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [columns]="cols" [lazy]="true" [scrollable]="false" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive" [resizableColumns]="false" columnResizeMode="fit" stateStorage="local" stateKey="datatable-local">
This is the code for maintaining local storage for a primeng table. The instructions are followed as per the documentation provided by primeNG (https://www.primefaces.org/primeng/#/table/state). But the state is not saved as expected. Can anyone mention why the state is not stored as expected. It gets reset when routed back or reset.
Any help appreciated
1 Answer(s)
-
0
Hi,
I think your project uses Angular 8.x. When I tried on https://www.primefaces.org/primeng-8.1.5/#/table/state (Angular 8 demo of PrimeNG), local storage doesn't work. But, when I try it on https://primefaces.org/primeng/showcase/#/table/state (it is Angular 9 demo), it works.
So, you can try using session storage or upgrade to Angular 9.