Hello, I want to sort a collection list by two criteria. I created two variables, sortbydaterdv
and sortbystatut
, whose values change between ‘ASC’ and ‘DESC’ when the user clicks on the icon in the header of the collection list. I bound the collection list to the formula sort(mycollection.data, sortbydaterdv, sortbystatut)
, but only one criterion is working. Can you help me, please?
weweb/supabase
Hi,
What I recommend is to have 2 variables:
- variable 1: sort ascending (boolean: true/false)
- variable 2: WHAT to sort on (name of the regarding field in the collection)
So then you just put your collection into a formula:
sort(mycollection.data, if(variable 1=true,“asc”,“desc”),variable2)
Hope this helps.