mirror of https://github.com/zulip/zulip.git
ui: Fix list_render sorting breaking after re-creation/update.
Previously, when list_render.create was called, if a list_render object with the given name existed, it returned the existing list_render object with the previous properties, without the property to sort the lists added. The root cause of the bug was that when we added the sorting click handlers, we put them just in the constructor, not in __set_events, the function we call from appropriate code paths to add the other necessary click handlers. Fix this by moving the code to add the sorting properties into __set_events(). Fixes #14175.
This commit is contained in:
parent
c220b971ae
commit
83ad56aa64
|
@ -284,6 +284,10 @@ exports.create = function ($container, list, opts) {
|
|||
}
|
||||
});
|
||||
|
||||
if (opts.parent_container) {
|
||||
opts.parent_container.on("click", "[data-sort]", exports.handle_sort);
|
||||
}
|
||||
|
||||
if (opts.filter.element) {
|
||||
opts.filter.element.on(opts.filter.event || "input", function () {
|
||||
const self = this;
|
||||
|
@ -348,11 +352,6 @@ exports.create = function ($container, list, opts) {
|
|||
DEFAULTS.instances.set(opts.name, prototype);
|
||||
}
|
||||
|
||||
// Attach click handler to column heads for sorting rows accordingly
|
||||
if (opts.parent_container) {
|
||||
opts.parent_container.on("click", "[data-sort]", exports.handle_sort);
|
||||
}
|
||||
|
||||
return prototype;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue