Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 277: | Line 277: | ||
cssClass: 'data-source-cell', | cssClass: 'data-source-cell', | ||
formatter: function (cell) { | formatter: function (cell) { | ||
const output = cell.getValue().reduce((prev, curr) => { | const val = cell.getValue(); | ||
let out = ''; | |||
groupedSources.forEach((group, gIndex) => { | |||
out += '<div>'; | |||
}, ''); | out += group.reduce((prev, curr) => { | ||
return output; | const idx = val.findIndex(src => src === curr.name); | ||
if (idx === -1) { | |||
return prev + '<div class="data-source-img> </div>' | |||
} else { | |||
return curr.image | |||
? prev + '<img class="data-source-img" data-value="' + curr + '" src="' + curr.image + '">' | |||
: prev + ' ' + curr; | |||
} | |||
}, ''); | |||
out += '</div>'; | |||
}); | |||
return out; | |||
// const output = cell.getValue().reduce((prev, curr) => { | |||
// const src = dataSources.find(src => src.name === curr); | |||
// const url = src ? src.image : ''; | |||
// return url ? prev + '<img class="data-source-img" data-value="' + curr + '" src="' + url + '">' : prev + ' ' + curr; | |||
// }, ''); | |||
// return output; | |||
} | } | ||
} | } |
Revision as of 15:13, 13 June 2022
Development verstion of the DCT List.
Not ready for production!