Add sorting to paginated tables
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
Browser sessionStorage or backend session?
sessionStorage is per browser tab right? I would do backend session
Let's also add ordering to the sensor-index
#1259 claims to check off the asset/sensors box in this issue. Can this issue be closed then?
#1259 claims to check off the asset/sensors box in this issue. Can this issue be closed then?
yes it can
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):
When clicking on the column to sort according to date (or any other column), the resulting table is empty:
Thanks for opening a separate issue for that: #1680