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