[#5641] changed the relation picker default sort to use rowid instead of created

This commit is contained in:
Gani Georgiev
2024-10-10 16:24:19 +03:00
parent 830e818eb7
commit 6a9784258f
29 changed files with 95 additions and 83 deletions
@@ -126,9 +126,14 @@
}
normalizedFilter += "(" + fileFields.map((f) => `${f.name}:length>0`).join("||") + ")";
let sort = "";
if (selectedCollection.type != "view") {
sort = "-@rowid"; // all collections with exception to the view has this field
}
const result = await ApiClient.collection(selectedCollection.id).getList(page, batchSize, {
filter: normalizedFilter,
sort: "-created",
sort: sort,
fields: "*:excerpt(100)",
skipTotal: 1,
requestKey: uniqueId + "loadImagePicker",
@@ -159,9 +159,14 @@
const fallbackSearchFields = CommonHelper.getAllCollectionIdentifiers(collection);
let sort = "";
if (!isView) {
sort = "-@rowid"; // all collections with exception to the view has this field
}
const result = await ApiClient.collection(collectionId).getList(page, batchSize, {
filter: CommonHelper.normalizeSearchFilter(filter, fallbackSearchFields),
sort: !isView ? "-created" : "",
sort: sort,
fields: "*:excerpt(200)",
skipTotal: 1,
expand: getExpand(),