Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 427: | Line 427: | ||
const filterState = {}; | const filterState = {}; | ||
const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block'); | if ( | ||
// Don't pass the filter on if everything is selected. | |||
document.querySelectorAll('#functions-filter input[type="checkbox"]').length !== | |||
document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length | |||
) { | |||
const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block'); | |||
const funcOpts = new Map(); | |||
functionFilterBlocks.forEach(block => { | |||
const cat = block.querySelector('input.func-cat'); | |||
if (cat.checked) { | |||
funcOpts.set( | |||
cat.value, | |||
Array.from(block.querySelectorAll('.subfunc-filter-block input[type="checkbox"]:checked')) | |||
.map(box => box.value) | |||
); | |||
} | |||
}); | |||
console.log(funcOpts) | |||
} | |||
const functionOptions = Array.from(document.querySelectorAll('#functions-filter input[type="checkbox"]')); | const functionOptions = Array.from(document.querySelectorAll('#functions-filter input[type="checkbox"]')); | ||
const selectedFunctions = functionOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); | const selectedFunctions = functionOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); |
Revision as of 16:35, 18 November 2022
Development verstion of the DCT List.
Not ready for production!