Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 128: | Line 128: | ||
filterState.dataSources = selectedSources; | filterState.dataSources = selectedSources; | ||
document.querySelectorAll('.source- | document.querySelectorAll('.data-source-cell .data-source-img').forEach(img => { | ||
if (selectedSources.includes(img.dataset.value)) { img.classList.remove('unchecked') } | |||
if (selectedSources.includes( | else { img.classList.add('unchecked'); } | ||
else { | |||
}); | }); | ||
Line 146: | Line 145: | ||
const identifier = escapeAttr(curr.name); | const identifier = escapeAttr(curr.name); | ||
return prev + | return prev + | ||
'<div | '<div><input type="checkbox" id="filter-' + identifier + '" value="' + curr.name + '" checked>' + | ||
'<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>' | '<label for="filter-' + identifier + '"><img src="' + curr.image + '"> ' + curr.name + '</label></div>' | ||
}, ''); | }, ''); | ||
Line 167: | Line 166: | ||
title: 'Data Sources', | title: 'Data Sources', | ||
field: 'dataSources', | field: 'dataSources', | ||
cssClass: 'data-source-cell', | |||
formatter: function (cell) { | formatter: function (cell) { | ||
const output = cell.getValue().reduce((prev, curr) => { | const output = cell.getValue().reduce((prev, curr) => { | ||
const src = dataSources.find(src => src.name === curr); | const src = dataSources.find(src => src.name === curr); | ||
const url = src ? src.image : ''; | const url = src ? src.image : ''; | ||
return url ? prev + '<img class="data-source-img" src="' + url + '">' : prev + ' ' + curr; | return url ? prev + '<img class="data-source-img" data-value="' + curr + '" src="' + url + '">' : prev + ' ' + curr; | ||
}, ''); | }, ''); | ||
return output; | return output; |
Revision as of 16:13, 8 June 2022
Development verstion of the DCT List.
Not ready for production!