Improve sorting behavior by adding delay
This commit is contained in:
1 parent
7941d929d2
commit
dabf1b2f43
10 files changed
+75
-87
No files matched your search
+4
-10
@@ -205,16 +205,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/permissions", ops);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user