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 90: Line 90:
     /**  
     /**  
     * @param {DCT} dct
     * @param {DCT} dct
     * @param {Partial<DCT>} params
     * @param {Partial<DCT>} filterState
     */
     */
     function dctFilter(dct, params) {
     function dctFilter(dct, filterState) {
         return true;
         return dct.dataSources.some(src => filterState.dataSources.includes(src));
     }
     }


Line 137: Line 137:
             ]
             ]
         });
         });
 
         table.on('tableBuilt', () => { table.setData(dcts); });
         table.on('tableBuilt', () => {  
            table.setData(dcts);  
        });


         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(el => el.value);
             table.setFilter(dctFilter, { dataSources: selectedSources });
             table.setFilter(dctFilter, { dataSources: selectedSources });
             console.log('Filter 1', table.getFilters())
             // console.log('Filter 1', table.getFilters())
         }, { passive: true });
         }, { passive: true });



Revision as of 13:50, 8 June 2022

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