Nov 14 2017 09:28 AM
Nov 14 2017 09:28 AM
Hi Everyone... Im hoping this is a very easily solution.
Building a Power App and i have a Template Gallery Display List on a screen which defaults to show the Created as Ascending. Is it possible to have the default view to be descending?
I have added a sort button and works fine but i need to know if you can have the default sort to be descending based upon the created date without the sort button.
As you can see from image below its just straight OTB and nothing crazy.
Apr 05 2019 03:12 AM
@Stuart Anderson I have exactly the same problem, I've been applying SortByColumns in various ways but can't get it to work, if I have any success, or you do, please let me know!
Apr 09 2019 02:48 AM
@mctriv been a couple years since this post. I have learned a few ways of doing this one. The best way to learn this is actually using one of the OTB templates in PowerApps as they have the sort order functionality already built, you just set the default to ascending or descending and then hide the button to change it.
Below are the Gallery formulas you could use;
SortByColumns(Filter('ICT Service Requests', StartsWith(Title, TextSearchBox1.Text)), "Created", If(SortDescending1, Descending, Ascending))
SortByColumns(Filter('ICT Service Requests', StartsWith(Title, TextSearchBox1.Text)), "Created", If(SortDescending1, Ascending, Descending))
The above is OTB for the Items section of the Gallery which usually is connected to a button for sort however if you just change the SortByColumns to be the other way around it works great. The default cannot be changed without using the SortByColumns option.
You will still need the button for the sort order as far as i have been able to work out which needs the onselect to be something like this.
But then just set the button to not be visible once you have the default to how you need it.
There may be a much more simple way of doing this though, but this is the quickest way i have found.
Jul 12 2022 02:19 AM
@Stuart Anderson been another few years since the last update on this topic, have you found any simpler/better ways of doing this?