mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
fix sort field not updating in export sidebar (#13133)
* fix sort field not updating in export sidebar * handle edge case better
This commit is contained in:
@@ -348,6 +348,10 @@ watch(exportSettings, () => {
|
||||
getItemCount();
|
||||
});
|
||||
|
||||
watch(primaryKeyField, (newVal) => {
|
||||
exportSettings.sort = newVal?.field ?? '';
|
||||
});
|
||||
|
||||
const sortDirection = computed({
|
||||
get() {
|
||||
return exportSettings.sort.startsWith('-') ? 'DESC' : 'ASC';
|
||||
@@ -458,7 +462,7 @@ function exportDataLocal() {
|
||||
export: format.value,
|
||||
};
|
||||
|
||||
if (exportSettings.sort) params.sort = exportSettings.sort;
|
||||
if (exportSettings.sort && exportSettings.sort !== '') params.sort = exportSettings.sort;
|
||||
if (exportSettings.fields) params.fields = exportSettings.fields;
|
||||
if (exportSettings.limit) params.limit = exportSettings.limit;
|
||||
if (exportSettings.search) params.search = exportSettings.search;
|
||||
@@ -480,7 +484,7 @@ async function exportDataFiles() {
|
||||
await api.post(`/utils/export/${collection.value}`, {
|
||||
query: {
|
||||
...exportSettings,
|
||||
sort: [exportSettings.sort],
|
||||
...(exportSettings.sort && exportSettings.sort !== '' && { sort: [exportSettings.sort] }),
|
||||
},
|
||||
format: format.value,
|
||||
file: {
|
||||
|
||||
Reference in New Issue
Block a user