mirror of
https://github.com/directus/directus.git
synced 2026-01-28 04:58:07 -05:00
Fix error with table manual sort (#9010)
This commit is contained in:
@@ -164,7 +164,9 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
|
||||
|
||||
function useTable() {
|
||||
const tableSort = computed(() => {
|
||||
if (sort.value?.[0].startsWith('-')) {
|
||||
if (!sort.value?.[0]) {
|
||||
return null;
|
||||
} else if (sort.value?.[0].startsWith('-')) {
|
||||
return { by: sort.value[0].substring(1), desc: true };
|
||||
} else {
|
||||
return { by: sort.value[0], desc: false };
|
||||
@@ -275,6 +277,10 @@ export default defineLayout<LayoutOptions, LayoutQuery>({
|
||||
|
||||
function onSortChange(newSort: { by: string; desc: boolean }) {
|
||||
let sortString = newSort.by;
|
||||
if (!newSort.by) {
|
||||
sort.value = [];
|
||||
return;
|
||||
}
|
||||
if (newSort.desc === true) {
|
||||
sortString = '-' + sortString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user