Add ability to select category via url in management page
parent
1388891ef5
commit
b9b4e25aec
|
@ -367,10 +367,18 @@ async function listItems(category) {
|
||||||
itemsListTable.appendChild(row);
|
itemsListTable.appendChild(row);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if(window.location.hash) {
|
||||||
|
let correctIndex;
|
||||||
|
let index = 0;
|
||||||
|
CATEGORIES.forEach(category => {
|
||||||
|
if(window.location.hash == '#' + category.name) correctIndex = index;
|
||||||
|
index++;
|
||||||
|
})
|
||||||
|
if(correctIndex || correctIndex === 0) categoryDropdown.selectedIndex = correctIndex;
|
||||||
|
}
|
||||||
listItems(CATEGORIES[categoryDropdown.selectedIndex]);
|
listItems(CATEGORIES[categoryDropdown.selectedIndex]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
categoryDropdown.onchange = () => {
|
categoryDropdown.onchange = () => {
|
||||||
listItems(CATEGORIES[categoryDropdown.selectedIndex]);
|
listItems(CATEGORIES[categoryDropdown.selectedIndex]);
|
||||||
};
|
};
|
||||||
|
|
Reference in New Issue