Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 288: | Line 288: | ||
cssClass: 'data-source-cell', | cssClass: 'data-source-cell', | ||
formatter: function (cell) { | formatter: function (cell) { | ||
const val = cell.getValue(); | |||
let out = ''; | |||
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; | |||
const output = cell.getValue().reduce((prev, curr) => { | // 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 + '" alt="' + curr +'" title="' + curr + '">' | |||
// : prev + ' ' + curr; | |||
}, ''); | // }, ''); | ||
return output; | // return output; | ||
} | } | ||
} | } |
Revision as of 18:32, 13 June 2022
Development verstion of the DCT List.
Not ready for production!