[CMS] Random sorting

Hi, it would be great to add a random sorting option for collections, for example, for displaying testimonials across the site.

8 Likes

Yes, please! And every page reload randomizes again!

Haha how would this happen?

@thesergie
Have a parent class for the dynamic list, then the same class for each dynamic list item, and the js used on this page:

OOh I feel you now… every page load would randomize the list. For some reason i thought you meant that clicking on an item would choose a random page for you. :scream:

That would be wild! I’m gonna try and use this js real quick to see if I can get it working on a dynamic list :smiley:

2 Likes

thanks @Waldo! that would be super cool!

I need this so much, my client want a randomized order of brands and i dont know how do it. =/

1 Like

Yes, this is absolutely a “must have”, and quickly !!! A lot of people needs random sorting of collections…

1 Like

Mmmm…random sorting. We want it :slight_smile:

Yes, random sorting!!

Hey @discovoador @buntestrahlen @tmfukushima @mietlicki @perkristian & @davidvm you can achieve this by adding in the following script (replace the “listitemclassname” with the class name which you give your list items):

    <script> var cards = $(".listitemclassname");
for(var i = 0; i < cards.length; i++){
    var target = Math.floor(Math.random() * cards.length -1) + 1;
    var target2 = Math.floor(Math.random() * cards.length -1) +1;
    cards.eq(target).before(cards.eq(target2));
} </script>

Here’s an example:
http://flow-in.webflow.io/

Here’s the Webflow Read-Only link: https://preview.webflow.com/preview/flow-in?preview=99d20c3007c32ab09ef1da4455a8de8c

Feel free to ask any questions. :slight_smile: Have fun!

5 Likes

i will try that tomorrow. trank you!

Yep, all I needed, thanks @Waldo!

1 Like

Thanks Waldo, i’ll try today. If works, will safe me a lot of time (until now, i made a sort list manualy every week =/)

Currently our caching for CMS sites gets cleared every 12hrs (twice in one day). So that means if we have sort set to random it will be randomized every 12 hours. Would that work?

2 Likes

Great @thesergie, that would absolutely do the trick for me. :slight_smile:

@perkristian @tmfukushima @discovoador @buntestrahlen @mietlicki @davidvm your wishes have come true:
http://forum.webflow.com/t/new-feature-random-dynamic-listing-ordering/23638

2 Likes

@perkristian @tmfukushima @discovoador @buntestrahlen @davidvm

Thanks for your patience. This feature is now live! Try it out :smile:
http://forum.webflow.com/t/new-feature-random-dynamic-listing-ordering/23638

4 Likes

Great stuff @PixelGeek & @Waldo! :slight_smile:
Works like a charm :beers:

1 Like