Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 450: Line 450:
  
 
         function applyFilters(clear) {
 
         function applyFilters(clear) {
             if (!table) return;
+
             if (!table) return; // prevent filtering before the table is ready
  
 
             // If clear=true, pass empty object to the filter to disable it.
 
             // If clear=true, pass empty object to the filter to disable it.
Line 462: Line 462:
  
 
             if (
 
             if (
                 // Don't pass the filter on if everything is selected.
+
                 // Don't pass the filter on if nothing is selected.
                document.querySelectorAll('#functions-filter input[type="checkbox"]').length !==
+
                 document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length > 0
                 document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length
 
 
             ) {
 
             ) {
 
                 const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
 
                 const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
Line 481: Line 480:
 
             }
 
             }
  
             const sourceOptions = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]'));
+
             const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked'))
            const selectedSources = sourceOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
+
                .map(checkbox => checkbox.value);
             filterState.dataSources = selectedSources.length === sourceOptions.length ? undefined : selectedSources;
+
             if (selectedSources.length > 0) filterState.dataSources = selectedSources;
  
 
             const bmOptions = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]'));
 
             const bmOptions = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]'));

Revision as of 15:13, 9 March 2023

Current version of the DCT List.
Not ready for production!