This commit is contained in:
2021-08-05 20:16:27 +00:00
parent 8f0fe74b0b
commit 181a002f17
3 changed files with 9 additions and 11 deletions

View File

@@ -30,7 +30,7 @@ export default {
// Used by forms to fetch selection list data
// Sorts alphabetically by default but can be turned off with do not sort
//
getSelectionList(enumKey) {
getSelectionList(enumKey, noSort) {
enumKey = enumKey.toLowerCase();
let e = window.$gz.store.state.enums[enumKey];
if (!e) {
@@ -42,19 +42,14 @@ export default {
}
let ret = [];
//de-lodash
// //turn it into an array suitable for selection lists
// window.$gz. _.forOwn(e, function(value, key) {
// ret.push({ id: Number(key), name: value });
// });
//return window.$gz. _.sortBy(ret, "name");
//turn it into an array suitable for selection lists
for (const [key, value] of Object.entries(e)) {
ret.push({ id: Number(key), name: value });
}
//sort by name
ret.sort(window.$gz.util.sortByKey("name"));
if (!noSort) {
ret.sort(window.$gz.util.sortByKey("name"));
}
return ret;
},
///////////////////////////////////