Improve sorting behavior by adding delay

This commit is contained in:
Divya Jagadish authored and Zaid Abdulla committed 2022-04-08 13:08:41 -07:00
1 parent 7941d929d2
commit dabf1b2f43
10 files changed
+75 -87

No files matched your search

+4 -10
View File
@@ -190,16 +190,10 @@ export const component: ClosureComponent = (): Component => {
}
function onSortChange(sortAttrs): void {
let _sort = Object.assign({}, sort);
for (const [index, direction] of Object.entries(sortAttrs)) {
// Changing the priority of columns
delete _sort[attributes[index].id];
if (direction)
_sort = Object.assign({ [attributes[index].id]: direction }, _sort);
}
const ops = {};
if (Object.keys(_sort).length) ops["sort"] = JSON.stringify(_sort);
const _sort = {};
for (const index of sortAttrs)
_sort[attributes[Math.abs(index) - 1].id] = Math.sign(index);
const ops = { sort: JSON.stringify(_sort) };
if (vnode.attrs["filter"]) ops["filter"] = vnode.attrs["filter"];
m.route.set("/admin/presets", ops);
}