Difference between revisions of "Widget:DCTList"

From LINKS Community Center
Jump to: navigation, search
Line 240: Line 240:
 
             if (group.length > 0) groupedSources.push(group);
 
             if (group.length > 0) groupedSources.push(group);
 
         }
 
         }
         groupedSources.push(dataSources);
+
        let html2 = '';
         console.log(groupedSources)
+
         groupedSources.forEach(group => {
 +
            html2 += group.reduce((prev, curr, idx) => {
 +
                const identifier = escapeAttr(curr.name);
 +
                return prev + '<div ' + (idx === 0 ? ' style="grid-column-start: 1">' : '>') +
 +
                '<input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' +
 +
                '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
 +
            }, '');
 +
         })
  
 
         const filterHtml = dataSources.reduce((prev, curr, idx) => {
 
         const filterHtml = dataSources.reduce((prev, curr, idx) => {
Line 249: Line 256:
 
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
 
                 '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>'
 
         }, '');
 
         }, '');
         document.getElementById('data-source-filter').innerHTML = filterHtml;
+
         document.getElementById('data-source-filter').innerHTML = html2;
  
 
         // Set up table.
 
         // Set up table.

Revision as of 15:45, 13 June 2022

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