Open LeXofLeviafan opened 2 years ago
Case in point: in a table without sortable columns, I've implemented sorting as a custom ‘filter’. This had a side effect of allowing to sort by multiple fields (e.g. “sort records by title in reverse order, and sort those with the same title by URL instead”)
?flt0_order_by_title=desc&flt1_order_by_url=asc
Now suppose the user wants to change the primary sorting field without changing the secondary one. He'll be expecting for the filters he set to retain their order after pressing ‘Apply’, right?
And yet what he gets after submitting his changes will be…
?flt3_order_by_tags=desc&flt1_order_by_url=asc
Example of filters being reordered when following pagination links:
An external ad-hoc fix was implemented in this pull-request (see bukuserver/static/bukuserver/js/filters_fix.js
for the frontend fixes, and bukuserver/views.py
for the backend fixes).
Note that since it's an external fix, the pagination links are fixed in the JS (the part starting with .pagination a:not([href^=javascript])
selector search), instead of fixing their generation code.
As far I'm aware, the number in the
fltN_
part of filter name refers to the filter order in the form, intended to retain said order on page refresh; and in the form itself it's handled by thelastCount
variable.The way it's currently handled, however, is as follows:
0
); this means filter indices are reset on form resubmission (which is also done by static links such as in pagination)2
, the next one to be added will have index4
, and if there's none, the first one added will have index1
); this means new filter indices differ from the ones they get on form resubmissionIs this actually the intended behaviour? Because I'm pretty sure the intuitively expected behaviour would be for the filters to retain their indices and UI order across page refreshes (except for when a filter is removed, anyway).