Improve sorting toggle behavior
Last sorted column now takes precedence over any previously sorted columns. This makes for a more intuitive user experience.
This commit is contained in:
1 parent
88a84788a5
commit
dd722ba6e0
9 files changed
+40
-27
No files matched your search
@@ -79,8 +79,6 @@ function renderTable(
|
||||
continue;
|
||||
}
|
||||
|
||||
let direction = 1;
|
||||
|
||||
let symbol = getIcon("unsorted");
|
||||
if (sortAttributes[i] > 0) symbol = getIcon("sorted-asc");
|
||||
else if (sortAttributes[i] < 0) symbol = getIcon("sorted-dsc");
|
||||
@@ -89,7 +87,7 @@ function renderTable(
|
||||
"button",
|
||||
{
|
||||
onclick: () => {
|
||||
if (sortAttributes[i] > 0) direction *= -1;
|
||||
const direction = ((sortAttributes[i] + 2) % 3) - 1;
|
||||
return onSortChange({ [i]: direction });
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user