top of page

Random Order for Repeater Items on Page Ready


The following code assumes your repeater is hidden on load and that you are filtering your dataset when the page loads.  Adjust the code as needed (including the element ID names).

You can see this code being used on this live page:


Good to Know #1

The Code

import wixData from 'wix-data';

$w.onReady(async function () {
    $w("#dataset1").onReady(async () => {

                .eq("designer", "designer")  //Our example sets a filter before running the randomization code
            .then((results) => {
 let repeaterItems = $w('#repeater1').data;
                $w('#repeater1').data = shuffle(repeaterItems);
            .catch((err) => {
 let errorMsg = err;


function shuffle(items) {
 var currentIndex = items.length,
        temporaryValue, randomIndex;
 while (0 !== currentIndex) {
        randomIndex = Math.floor(Math.random() * currentIndex);
        currentIndex -= 1;
        temporaryValue = items[currentIndex];
        items[currentIndex] = items[randomIndex];
        items[randomIndex] = temporaryValue;
 return items;



by Code Queen

Stuck on a project? Hire Code Queen, LLC!

Schedule a phone call or video call directly online. In a different time zone? No problem! Code Queen currently has clients around the world.

Online Booking: Discovery Session

Contact Form: Send project details

225 views0 comments



a quick note about our website content

Our free and premium content is non-exclusive, meaning you are not the only one with access to the content. You can customize our content to fit your end product. Redistribution of our content is strictly prohibited. This means you cannot make our content available to others as-is, stand-alone products or stock products in ANY LANGUAGE, regardless if you offer our content for free or not.

bottom of page