flexmeasures icon indicating copy to clipboard operation
flexmeasures copied to clipboard

Add sorting to paginated tables

Open nhoening opened this issue 1 year ago • 1 comments

Sorting by clicking the column heading was available before pagination (when all data was loaded at once and present). Since we use pagination on data tables, clicking the column headings leads to odd behavior. Let us add an issue (ideas below) to fix that in all our pagination places.

I can imagine we'd actually need two additional parameters for all our paginatable endpoints: sort_by and sort_dir. Clicking a table head would add them to the query (not sure how to overwrite the existing behavior, looking at the DataTable docs is in order, I guess). And the endpoint should probably save these parameters in the session, so that all other actions on the table (e.g. clicking next page number) respect the current ordering.

We need this in existing paginated tables:

  • [ ] assets
  • [ ] users
  • [ ] accounts
  • [ ] asset/sensors

nhoening avatar Sep 26 '24 20:09 nhoening

Browser sessionStorage or backend session?

Flix6x avatar Sep 27 '24 17:09 Flix6x

sessionStorage is per browser tab right? I would do backend session

nhoening avatar Nov 01 '24 08:11 nhoening

Let's also add ordering to the sensor-index

nhoening avatar Nov 01 '24 08:11 nhoening

#1259 claims to check off the asset/sensors box in this issue. Can this issue be closed then?

Flix6x avatar Nov 27 '24 15:11 Flix6x

#1259 claims to check off the asset/sensors box in this issue. Can this issue be closed then?

yes it can

joshuaunity avatar Nov 28 '24 08:11 joshuaunity

I am not quite sure, if this is the right issue, but I think I encountered a bug that goes here.

On the asset status page (fmserver.tld/assets/<id>/status), we can see the lates jobs on the bottom. The jobs are listed in random order (I would prefer them to be sorted according to the first column, date): Image

When clicking on the column to sort according to date (or any other column), the resulting table is empty: Image

beralt85 avatar Aug 28 '25 10:08 beralt85

Thanks for opening a separate issue for that: #1680

Flix6x avatar Aug 28 '25 18:08 Flix6x