primevue
primevue copied to clipboard
TreeTable: sorting does not work with lazy-loaded data
Describe the bug
TreeTable with lazy loaded data. Clicking on the column headers changes the sort icon, but not the order of displayed rows.
Example was made by only adding sortable
to the column definition of the lazy load from documentation.
Reproducer
https://stackblitz.com/edit/7mwdun?file=src%2FApp.vue
PrimeVue version
3.51.0
Vue version
3.x
Language
ES6
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
- Load example
- Click on column header - row order does not change
Expected behavior
Row order does change depending on data.
Seems to be same for the DataTable component, Is there a workaround for this problem? Which version was the last known working version?
3.52.0 - sort with lazy load does not work.
I've tried to use @sort="onSort($event)". Sort works but when one clicks sort on column on page other then first, paginator set current page to 1.
UPDATE: looks like in my case current page is set to 0 because of emit 'update:first' with 0 as payload in onColumnHeaderClick function.
Why is it necessary to reset page on sorting page dataset?
UPDATE2: even if manually emit('update:first') with real page on behalf of datatable or any other component, current page will not setting back.
nested sorting doesn't work in general, even when data is not lazy loaded
Unfortunately yes, it does not work but it should because if dataset is already fetched - there is no need to ask server again but with some order applied.