Show all columns from table

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};

    });

}

Try:

//call the getList from inside the $w.onReady
function getList() {
    wixData.query("RentalBlockDates")
        .find()
        .then(r => {
            $w('#table1').rows = buildUniqueRecords(r.items);
        });
}

function buildUniqueRecords(items){
items = items.filter((e,i) => items.findIndex( q => q.title === e.title) === i);
return items;
}

Awesome - this worked!

Thanks J.D.

You’re welcome :slight_smile: