Jump to content
Sign in to follow this  
Greg Hains

Toggle sort ascending/descending

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Hi.

Its a list Im sorting. Please explain how I can setup, toggle, and then subsequently read this flag.

Thanks for your response by the way.

Greg

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Many thanks for your help.

I should be able to take it from here.

Greg :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Who Viewed the Topic

    1 member has viewed this topic:
    ron n 
×

Important Information

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