Widget: DCTList: Difference between revisions

From LINKS Community Center
Jump to: navigation, search
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');
            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)
            // If everything is selected, disable functions filter.
             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);
             filterState.functions = selectedFunctions.length === functionOptions.length ? undefined : selectedFunctions;
             filterState.functions = selectedFunctions.length === functionOptions.length ? undefined : selectedFunctions;



Revision as of 16:29, 18 November 2022

Development verstion of the DCT List.
Not ready for production!