The data of the template grid is displayed randomly on the page
I want to make a template grid where data can be displayed randomly. Every time I refresh the template grid, it will re-grab the data and display it randomly. How can I do this and is Mendix allowed?
yi tsen hsu
I think you can do the following:
On the entity you show on the template grid create a decimal attribute called ‘Sorting’
Create a microflow to open the page with the template grid
In this microflow loop over all objects you want to show in de templategrid
Use a change object in the loop. Change ‘Sorting’ and set the value to: random()
On the page sort the template grid on ‘Sorting’ attribute
Create a refresh button that loops over all objects and sets ‘Sorting’ to a new value.
The data will now be shown in a random order everytime.
Hope this helps!
Hi Yi Tsen,
If you want to randomize the data that you are displaying in the template grid, you could use an already existing Marketplace Module called Fake Data.
I think you could use that module to generate/update the random data into the attributes that you will be displaying in your template grid. You probably will need to set a microflow call for scrambling the data first and then an Open Page action (or you could have a “refresh” button to scramble the data everytime you want different data).