On my homepage, I have a repeater that connected to a dataset, and on the dataset, i have 5 items, and i only want to display 3 of them at each time
But i use code to shuffle which item to display, so it cancel the 3 display limit set on the dataset settings.
How can i override this?
let items;
function shuffleArray() {
let itemsLength = items.length, lastItem, randomIndex;
while (itemsLength) {
randomIndex = Math.floor(Math.random() * itemsLength--);
lastItem = items[itemsLength];
items[itemsLength] = items[randomIndex];
items[randomIndex] = lastItem;
}
return items;
}
$w.onReady( () => {
$w("#dataset1").onReady( () => {
$w("#dataset1").getItems(0, 5)
.then( (results) => {
items = results.items;
$w("#repeater4").data = shuffleArray(items);
})
})
})