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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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