I was having issues with the max number of items in a repeater when using “randomising” code. The code works fine, but the max number in the dataset settings seems to be bypassed by the code. I have a client that manages 70 clients and I only want to see 16 on the home page.
I was told to use a slice() method on the returned array to set the maximum, but I don’t know where to include the SLICE() method in my code.
Can someone help me out please ? Thanks !
Here is my code (clearly I can’t add a code snippet, sorry)
import wixData from ‘wix-data’ ;
First of all, if you wish to retrieve the 70 clients, you have to add limit to the query (otherwise it’’ only bring the first 50).
wixData.query("Team")
.limit(70)
.find()
Second, it’s not clear why you run a direct query if you have all the clients in dataset1 ?(which I guess represent the Team collection). It’ll affect the performance.
If I’m right, set dataset1 to have at least 70 items (via the UI editor), get rid of the direct query and instead do:
The initial code was taken from another post that just wanted to shuffle the images. I am looking to shuffle images in a repeater, but only for 16 images at a time.
Your code seems simpler and limits the images at 16, but actually doesn’t shuffle the images. I only included your code and took out the previous one. Something I am doing wrong ?