primevue icon indicating copy to clipboard operation
primevue copied to clipboard

TreeTable: sorting does not work with lazy-loaded data

Open ray007 opened this issue 9 months ago • 4 comments

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.

ray007 avatar May 08 '24 13:05 ray007

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

memin20 avatar May 14 '24 11:05 memin20

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.

alqa-dash avatar May 17 '24 12:05 alqa-dash

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

sergeydus avatar May 26 '24 07:05 sergeydus

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.

alqa-dash avatar May 27 '24 05:05 alqa-dash