Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 140: | Line 140: | ||
width: 2em; | width: 2em; | ||
height: 2em; | height: 2em; | ||
margin: 0 .5em; | margin: 0 .5em 0 0; | ||
} | } | ||
Line 357: | Line 357: | ||
? dct.functions.some(func => filterState.functions.includes(func)) | ? dct.functions.some(func => filterState.functions.includes(func)) | ||
: true; | : true; | ||
return sourcesCheck && functionsCheck; | const businessModelCheck = filterState.businessModel | ||
? dct.businessModel.some(bm => filterState.businessModel.includes(bm)) | |||
: true; | |||
return sourcesCheck && functionsCheck && businessModelCheck; | |||
} | } | ||
Line 374: | Line 377: | ||
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; | ||
const sourceOptions = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]')); | const sourceOptions = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]')); | ||
const selectedSources = sourceOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); | const selectedSources = sourceOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); | ||
filterState.dataSources = selectedSources.length === sourceOptions.length ? undefined : selectedSources; | |||
const bmOptions = Array.from(document.querySelectorAll('#business-model-filter input[type="checkbox"]')); | |||
filterState. | const selectedBModels = bmOptions.filter(checkbox => checkbox.checked).map(checkbox => checkbox.value); | ||
filterState.businessModel = selectedBModels.length === bmOptions.length ? undefined : selectedBModels; | |||
table.setFilter(dctFilter, filterState); | table.setFilter(dctFilter, filterState); | ||
Line 591: | Line 594: | ||
}, { passive: true }); | }, { passive: true }); | ||
document.getElementById('functions-filter').addEventListener('change', event => { | document.getElementById('functions-filter').addEventListener('change', event => { | ||
applyFilters(); | |||
}, { passive: true }); | |||
document.getElementById('business-model-filter').addEventListener('change', event => { | |||
applyFilters(); | applyFilters(); | ||
}, { passive: true }); | }, { passive: true }); |
Revision as of 14:40, 12 September 2022
Development verstion of the DCT List.
Not ready for production!