Skip to content

Commit

Permalink
Default list are all cat
Browse files Browse the repository at this point in the history
  • Loading branch information
HThuren committed Jul 5, 2024
1 parent 569b4c9 commit e8a91e5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/js/tabs/auxiliary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand All @@ -126,11 +135,6 @@ function createCategorySelect(table, map) {
categorySelect.append(`<option value="${value.name}">${value.name}</option>`);
}
}
/*
else {
categorySelect.append(`<option value="${value.name}" disabled="disabled">${value.name}</option>`);
}
*/
}

const modeWidth = 125;
Expand Down

0 comments on commit e8a91e5

Please sign in to comment.