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 364: Line 364:
                 ? dct.businessModel.some(bm => filterState.businessModel.includes(bm))
                 ? dct.businessModel.some(bm => filterState.businessModel.includes(bm))
                 : true;
                 : true;
             return sourcesCheck && functionsCheck && businessModelCheck;
            const dmUseCheck = filterState.usedByDmo
                ? filterState.usedByDmo.indexOf(dct.usedByDmo) > 0
                : true;
             return sourcesCheck && functionsCheck && businessModelCheck && dmUseCheck;
         }
         }


Line 376: Line 379:
             }
             }


             /** @type {Partial<DCT>} */
             /** @type {Partial<Omit<DCT, 'usedByDmo'> & { usedByDmo: string[]>}} */
             const filterState = {};
             const filterState = {};


Line 390: Line 393:
             const selectedBModels = bmOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
             const selectedBModels = bmOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
             filterState.businessModel = selectedBModels.length === bmOptions.length ? undefined : selectedBModels;
             filterState.businessModel = selectedBModels.length === bmOptions.length ? undefined : selectedBModels;
            const dmUseOptions = Array.from(document.querySelectorAll('#dm-use-filter input[type="checkbox"]'));
            const selectedDmUseOptions = dmUseOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value);
            filterState.usedByDmo = selectedDmUseOptions.length === dmUseOptions.length ? undefined : selectedDmUseOptions;


             table.setFilter(dctFilter, filterState);
             table.setFilter(dctFilter, filterState);
Line 624: Line 631:
             }, { passive: true });
             }, { passive: true });
             document.getElementById('business-model-filter').addEventListener('change', event => {
             document.getElementById('business-model-filter').addEventListener('change', event => {
                applyFilters();
            }, { passive: true });
            document.getElementById('dm-use-filter').addEventListener('change', event => {
                 applyFilters();
                 applyFilters();
             }, { passive: true });
             }, { passive: true });

Revision as of 12:40, 13 September 2022

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