Hi All,
With the help of previous articles, i was able to remove the duplicates from my table’s list by the title. The table shows the correct number of rows, and the correct titles, but i can’t seem to get it to display the rest of the data that corresponds with the title; start date & end date.
My Table
My Code
function getList() {
wixData.query("RentalBlockDates")
.find()
.then((results) => {
const uniqueTitles = getUniqueTitles(results.items);
$w('#table1').rows = buildOptions(uniqueTitles);
});
}
function getUniqueTitles(items) {
const titlesOnly = items.map(item => item.title);
// Return an array with a list of unique titles
return [...new Set(titlesOnly)]
}
function buildOptions(uniqueList) {
return uniqueList.map(curr => {
return { "title": curr};
});
}