Sort a collection on a user action

is it possible to sort a dynamic collection on a user action? or should I load it into a variable to be able to sort it, in this second case, how can I create flexbox lines, as it is possible to do from a collection?

Hey @Tchicken ,

To sort a dynamic collection on a user click, I would
A - create the variables
1 - create a variable “sort_by” (type “text”), with a default value (ex: “name”)
2 - create another variable “sort_order” (type “text”), with the default value “ASC”

B - bind your sorting (in your collection binding formula) to these variables
In the sortable collection,
1 - bind the field to the variable “sort_by”, and
2 - the direction to the variable “sort_order”

C- make it work on a click by the user
Now you can just add a workflow for the button, with the action “change the variable” (sort_by and/or sort_order), and the value of that changed variable to
1 - the field you want to sort by, and/or
2 - the order you want (ASC or DESC - in capital letters :wink: )

You can add sophistications in the workflow, of course, but it’s basically what I’ve juste done.

Hope that helps !
Feel free to ask if I wasn’t clear (thinking of making a video for this when I have some time).

For the second case, not sure to understand what you mean by “flexbox lines”…

2 Likes

Cool!