From e8a91e5e29bc147a8ec0352a135e82cd23635cac Mon Sep 17 00:00:00 2001 From: HThuren Date: Wed, 21 Feb 2024 20:54:30 +0100 Subject: [PATCH] Default list are all cat --- src/js/tabs/auxiliary.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/js/tabs/auxiliary.js b/src/js/tabs/auxiliary.js index 2a3ab5d611..2966c43d2b 100644 --- a/src/js/tabs/auxiliary.js +++ b/src/js/tabs/auxiliary.js @@ -106,13 +106,22 @@ function getCategoryNames(table, buildKey) { return categoryChoise; } +function generateDefaultList(categoryTable) { + let list = []; + for (const item of categoryTable) { + list.push(item.name); + } + return list; +} + function createCategorySelect(table, map) { let categorySelect = $('select.auxiliary_category_select'); + const allCat = generateDefaultList(categoryTable); - const categoryNameObj = getConfig('auxiliaryCategoryNameList', ''); // read user pre selected categories + const categoryNameObj = getConfig('auxiliaryCategoryNameList', allCat); // read user pre selected categories, if empty default to complete list let categoryNameList = categoryNameObj.auxiliaryCategoryNameList; if (categoryNameList.length == 0) { - categoryNameList = getCategoryNames(table, 'all'); // empty choise -> select names from 'all' category + categoryNameList = getCategoryNames(table, 'all'); // empty choise -> select names from 'all' category setConfig({ auxiliaryCategoryNameList: categoryNameList }); } @@ -126,11 +135,6 @@ function createCategorySelect(table, map) { categorySelect.append(``); } } -/* - else { - categorySelect.append(``); - } -*/ } const modeWidth = 125;