Is it possible to sort the items displayed using a repeater based on user input? I have a dataset containing paintings, and I would like to let the user sort these by title, year or subject by clicking buttons.
I tried using something along the lines of:
$w("#sortByTitleButton").onClick(() => {
$w("#worksDataset").setSort(
wixData.sort()
.ascending("Title")
);
console.log("Sorting by Title");
});
And, this does alter the sort order of the repeater items. But, the resulting order is incorrect. It’s probably not random order. But, I can’t make heads or tails of it. Any suggestions?