Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 414: Line 414:
 
             // If filtering property is empty, don't apply the filter (set the check to true).
 
             // If filtering property is empty, don't apply the filter (set the check to true).
 
             // Passing an empty object (as with applyFilters(true)) should result in an unfiltered table.
 
             // Passing an empty object (as with applyFilters(true)) should result in an unfiltered table.
 +
 +
            console.log('FILT', filterState)
  
 
             let functionsCheck = true;  // automatically pass functions check if the filter missing
 
             let functionsCheck = true;  // automatically pass functions check if the filter missing
Line 461: Line 463:
 
             const filterState = {};
 
             const filterState = {};
  
             if (
+
             if (document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length > 0) {
                // Don't pass the filter on if nothing is selected.
 
                document.querySelectorAll('#functions-filter input[type="checkbox"]:checked').length > 0
 
            ) {
 
 
                 const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
 
                 const functionFilterBlocks = document.querySelectorAll('#functions-filter .func-filter-block');
 
                 const funcOpts = new Map();
 
                 const funcOpts = new Map();
Line 484: Line 483:
 
             if (selectedSources.length > 0) filterState.dataSources = selectedSources;
 
             if (selectedSources.length > 0) filterState.dataSources = selectedSources;
  
             const bmOptions = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]'));
+
             const selectedBModels = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]:checked'))
            const selectedBModels = bmOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
+
                .map(checkbox => checkbox.value);
             filterState.businessModel = selectedBModels.length === bmOptions.length ? undefined : selectedBModels;
+
             if (selectedBModels.length > 0) filterState.businessModel = selectedBModels;
  
             filterState.usedByDmo = document.getElementById('used-by-practitioners').checked ? 'yes' : undefined;
+
             if (document.getElementById('used-by-practitioners').checked) filterState.usedByDmo = 'yes';
             filterState.hasUC = document.getElementById('has-use-case').checked ? 'yes' : undefined;
+
             if (document.getElementById('has-use-case').checked) filterState.hasUC = 'yes';
  
 
             table.setFilter(dctFilter, filterState);
 
             table.setFilter(dctFilter, filterState);

Revision as of 15:19, 9 March 2023

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