primeui icon indicating copy to clipboard operation
primeui copied to clipboard

Calling DataTable "reload" after data source update prevents page count updates

Open ritchiecarroll opened this issue 9 years ago • 1 comments

If you modify the total number of rows in your data source (e.g., by adding or deleting) and update the paginator to properly reflect new state (e.g., by updating new record count by calling "setTotalRecords" method) - then subsequent call to the "reload" method on the data table causes the paginator to get reset to its initial pageCount state preventing access to newly added items and leaving empty pages for deleted items.

http://jsfiddle.net/ritchiecarroll/9ez9njwd/

A work around exists by manually setting page back to zero after "setTotalRecords" call and not calling "reload" method, e.g.: $('#tblremotelazy').puidatatable('getPaginator').puipaginator('setPage', 0);

ritchiecarroll avatar Apr 07 '16 20:04 ritchiecarroll

you can call "filter" or "sort" on the datatable and that will cause it to reload (refetch if using remote data function). this only works, though, if you have filtering or sorting enabled. otherwise it quietly fails. it is a dirty workaround, but it does work.

sfisque avatar Sep 27 '18 04:09 sfisque