primefaces / primevue

Next Generation Vue UI Component Library
https://primevue.org
MIT License
10.07k stars 1.2k forks source link

TreeTable: sorting does not work with lazy-loaded data #5703

Open ray007 opened 4 months ago

ray007 commented 4 months ago

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

  1. Load example
  2. Click on column header - row order does not change

Expected behavior

Row order does change depending on data.

memin20 commented 4 months ago

Seems to be same for the DataTable component, Is there a workaround for this problem? Which version was the last known working version?

alqa-dash commented 4 months ago

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.

sergeydus commented 4 months ago

nested sorting doesn't work in general, even when data is not lazy loaded

alqa-dash commented 4 months ago

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.