Difference between revisions of "Widget:DCTList"
From LINKS Community Center
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 17:35, 18 November 2022
Development verstion of the DCT List.
Not ready for production!