evidence-dev / evidence

Business intelligence as code: build fast, interactive data visualizations in pure SQL and markdown
https://evidence.dev
MIT License
4.47k stars 215 forks source link

fixed datatable not displaying sorted group data #2809

Closed kwongz closed 3 days ago

kwongz commented 3 days ago

Description

Originally Data Table was only sorted based on aggregated group values, but the data within each group was unsorted

Group name not sorting, GDP Growth Russia negative value always first in group

https://github.com/user-attachments/assets/b859d0df-f2d4-4a77-8c42-1bee29100746

After investigation, the issue was identified: the sorted data was overwritten because the displayed data was repopulated from the original data set. This PR resolves the problem by ensuring the displayed data is only populated during the initial render or when the data changes. This allows the sorted data to render correctly on the page.

https://github.com/user-attachments/assets/b46bd387-da79-4c78-84fb-9ed0ac191cbb

Checklist

kwongz commented 3 days ago

fixes #2764