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
+7
-11
@@ -268,18 +268,14 @@ export const component: ClosureComponent = (): Component => {
|
||||
}
|
||||
|
||||
function onSortChange(sortedAttrs): void {
|
||||
let _sort = Object.assign({}, sort);
|
||||
for (const [index, direction] of Object.entries(sortedAttrs)) {
|
||||
const param = memoizedGetSortable(attributes[index].parameter);
|
||||
if (param) {
|
||||
// Changing the priority of columns
|
||||
delete _sort[param];
|
||||
if (direction) _sort = Object.assign({ [param]: direction }, _sort);
|
||||
}
|
||||
const _sort = {};
|
||||
for (const index of sortedAttrs) {
|
||||
const param = memoizedGetSortable(
|
||||
attributes[Math.abs(index) - 1].parameter
|
||||
);
|
||||
_sort[param] = Math.sign(index);
|
||||
}
|
||||
|
||||
const ops = {};
|
||||
if (Object.keys(_sort).length) ops["sort"] = JSON.stringify(_sort);
|
||||
const ops = { sort: JSON.stringify(_sort) };
|
||||
if (vnode.attrs["filter"]) ops["filter"] = vnode.attrs["filter"];
|
||||
m.route.set("/devices", ops);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user