[#478] load selected relation items before the other options

This commit is contained in:
Gani Georgiev
2022-09-18 01:18:54 +03:00
parent 978fdd3ce7
commit 9814dda8e4
12 changed files with 22 additions and 22 deletions
@@ -14,7 +14,7 @@
};
}
// leave the validation to the api
// note: leave the validation to the api
// $: if (!CommonHelper.isEmpty(options.values) && options.maxSelect > options.values.length) {
// options.maxSelect = options.values.length;
// }
@@ -23,7 +23,7 @@
let isLoadingSelected = false;
$: if (collectionId) {
loadSelected().then(function () {
loadSelected().then(() => {
loadList(true);
});
}
@@ -86,11 +86,11 @@
});
if (reset) {
list = [];
list = CommonHelper.toArray(selected).slice();
}
list = CommonHelper.filterDuplicatesByKey(
CommonHelper.toArray(selected).concat(list, result.items)
list.concat(result.items, CommonHelper.toArray(selected))
);
currentPage = result.page;
totalItems = result.totalItems;
+5 -5
View File
@@ -23,9 +23,9 @@
$: canLoadMore = totalItems > list.length;
loadList(true);
loadSelected();
loadList(true).then(() => {
loadSelected();
});
async function loadSelected() {
const selectedIds = CommonHelper.toArray(keyOfSelected);
@@ -76,11 +76,11 @@
});
if (reset) {
list = [];
list = CommonHelper.toArray(selected).slice();
}
list = CommonHelper.filterDuplicatesByKey(
CommonHelper.toArray(selected).concat(list, result.items)
list.concat(result.items, CommonHelper.toArray(selected))
);
currentPage = result.page;
totalItems = result.totalItems;