Jump to content
Server Maintenance This Week. ×

Toggle sort ascending/descending


This topic is 6188 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi.

I have a column that I want users to be able to click the column header and toggle between the data sorting ascending and descending. I know that two seperate buttons will do the trick, but want to know if there's a way I can either detect a columns sort status, or have some sort of toggled status I can refer to to then run a script.

Any ideas please?

Greg

Link to comment
Share on other sites

Is this in a portal or on a list layout? If it's a list layout you would simply call a script to sort the records, and then set a flag as "ascending" or "descending" When you call the script again, just branch the script to sort the opposite way and reset the flag. Open one of the built-in templates and look at the scripts used for sorting the list view

If you're sorting a portal, then it's trickier, but there are many methods if you search the forums for portal sorting.

Link to comment
Share on other sites

If[ $$sortOrder = "Asc" ]

Sort Records[ do your descending sort here ]

Set Variable[$$sortOrder ; "Desc" ]

Else

Sort Records [ do your ascending sort here ]

Set Variable[ $$sortOrder ; "Asc" ]

End If

You can then at any time retrieve your current sort order as it is stored in the $$sortOrder variable.

Link to comment
Share on other sites

This topic is 6188 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.