mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
list_render: Fix filtering/sorting.
This code has always been kind of convoluted
and buggy, starting with the first
sorting-related commit, which put filtering
before sorting for some reason:
3706e2c6ba
This should fix bugs like the fact that
changing filter text would not respect
reversed sorts.
Now the scheme is simple:
- external UI actions set `meta` values like
filter_value, reverse_mode, and
sorting_function, as needed, through
simple setters
- use `hard_redraw` to do a redraw and
trigger external actions
- all filtering/sorting/reverse logic on
the *data* happens in a single, simple
function called `filter_and_sort`
This commit is contained in:
@@ -236,7 +236,13 @@ function sort_button(opts) {
|
||||
closest: lookup('.progressive-table-wrapper', {
|
||||
data: lookup('list-render', opts.list_name),
|
||||
}),
|
||||
hasClass: lookup('active', opts.active),
|
||||
hasClass: (sel) => {
|
||||
if (sel === 'active') {
|
||||
return opts.active;
|
||||
}
|
||||
assert.equal(sel, 'descend');
|
||||
return false;
|
||||
},
|
||||
siblings: lookup('.active', {
|
||||
removeClass: (sel) => {
|
||||
assert.equal(sel, 'active');
|
||||
|
||||
Reference in New Issue
Block a user