[#478] load selected relation items before the other options
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user