Widget: DCTList: Difference between revisions
From LINKS Community Center
Eschmidt (talk | contribs) No edit summary |
Eschmidt (talk | contribs) No edit summary |
||
Line 225: | Line 225: | ||
const dataSources = data[0]; | const dataSources = data[0]; | ||
const dcts = data[1]; | const dcts = data[1]; | ||
// Set up filters. | // Set up filters. | ||
Line 236: | Line 233: | ||
for (const source of layoutGroup) { | for (const source of layoutGroup) { | ||
let idx = sourcesCopy.findIndex(src => src.name === source); | let idx = sourcesCopy.findIndex(src => src.name === source); | ||
if (idx !== -1) { | if (idx !== -1) { group.push(sourcesCopy.splice(idx, 1)[0]); } | ||
} | } | ||
if (group.length > 0) groupedSources.push(group); | if (group.length > 0) { groupedSources.push(group); } | ||
} | } | ||
groupedSources.push(sourcesCopy); | groupedSources.push(sourcesCopy); | ||
let filterHtml = ''; | |||
let | |||
groupedSources.forEach(group => { | groupedSources.forEach(group => { | ||
filterHtml += group.reduce((prev, curr, idx) => { | |||
const identifier = escapeAttr(curr.name); | const identifier = escapeAttr(curr.name); | ||
return prev + '<div ' + (idx === 0 ? ' class="filter-group-start">' : '>') + | return prev + '<div ' + (idx === 0 ? ' class="filter-group-start">' : '>') + | ||
Line 254: | Line 248: | ||
}, ''); | }, ''); | ||
}) | }) | ||
document.getElementById('data-source-filter').innerHTML = filterHtml; | |||
document.getElementById('data-source-filter').innerHTML = | |||
// Set up table. | // Set up table. |
Revision as of 14:54, 13 June 2022
Development verstion of the DCT List.
Not ready for production!