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 64: Line 64:
         const sources = Object.getOwnPropertyNames(results).map(platformName => ({
         const sources = Object.getOwnPropertyNames(results).map(platformName => ({
             name: platformName,
             name: platformName,
             image: getUrl(results[platformName].printouts.IMAGE[0].fulltext.replace('PAGENAME:', ''))
             image: getUrl(results[platformName].printouts['IMAGE'][0].fulltext.replace('PAGENAME:', ''))
         }));
         }));


Line 149: Line 149:


         document.getElementById('data-source-filter').addEventListener('change', event => {
         document.getElementById('data-source-filter').addEventListener('change', event => {
             const selectedSources = Array.from(document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked')).map(el => el.value);
             const selectedSources = Array.from(
                document.querySelectorAll('#data-source-filter input[type="checkbox"]:checked')
            ).map(checkbox => checkbox.value);
 
             table.setFilter(dctFilter, { dataSources: selectedSources });
             table.setFilter(dctFilter, { dataSources: selectedSources });
         }, { passive: true });
         }, { passive: true });
Line 156: Line 159:


     function selectAll() {
     function selectAll() {
        // This won't trigger the 'change' event
         document.querySelectorAll('#data-source-filter input[type="checkbox"]').forEach(el => el.checked = true);
         document.querySelectorAll('#data-source-filter input[type="checkbox"]').forEach(el => el.checked = true);
        console.log('select all')
     }
     }
     function deselectAll() {
     function deselectAll() {
        // This won't trigger the 'change' event
         document.querySelectorAll('#data-source-filter input[type="checkbox"]').forEach(el => el.checked = false);
         document.querySelectorAll('#data-source-filter input[type="checkbox"]').forEach(el => el.checked = false);
        console.log('deselect all')
     }
     }
     </script>
     </script>

Revision as of 14:23, 8 June 2022

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