Sort and SortHeader

By DavidT

August 01, 2009


Sorting results by using the built in syntax provided for controlling not only the rendered data order, but also for dynamically modifying the standard, ascending and descending display headers is easy with our syntax specification. All runtime actions like Sorting, Interactive Lists and Actions use a similar formatting structure contained within curly braces {...}. The Sort syntax requires seven parameters. The Type of the action - SORT, the name of the column used in the sort, the Standard display formatting, the Ascending display formatting, the Descending display formatting, the default order (ASC,DESC or nothing), and the Index of the Sort relative to the list. The sort Index is used to replace the occurrence(s) of any {SORTHEADER,Index} tag where the Index would be the Sort Index contained in the sort tag.

Sorting Syntax

Sorting handlers are made up of a pair of syntax elements. The first provides the ability to identify the structure of the actual sorting configuration and handles all of the sort parameters including the sort index. The second is simply a placeholder for the output of the sort configuration called the Sort header. The sort configuration element will render a formulated HREF tag which is required for Anchor tag elements. The action tag will execute a javascript function built in to ListX, so the SORT element should always occur within an ANCHOR tag. The SORTHEADER tag would then be placed as the contents of the ANCHOR.

The sorting is a three click approach, iterating through the options of none, ascending and descending upon each click from the mouse.

Sort Syntax: {SORT,ColumnName,StandardText,AscendingText,DescendingText,DefaultOrder,SortIndex, optional sortQuerystring, optional sortTargetId}

Sort Header Syntax: {SORTHEADER,SortIndex}

 

Example


<tr>

<th><a {SORT,EventDate,Date,"Date <img src=asc.gif>", "Date <img src=desc.gif>",ASC,7}>{SORTHEADER,7}</a></th>

</tr>

Interaction Type
All interaction elements for ListX utilize similar formatting to keep things uniform. Check lists and Check list Items are always contained within curly braces {...} with the first parameter identifying the type of interaction. In the case of this element, SORT or SORTHEADER will be the first parameter. Other types of actions include ACTION,RADIO, and other types including CHECKLIST.

Column Name
The name of the column which will be sorted. The variable may be a single column name, or could utilize the Column Value syntax to build combined - or formatted values.

Standard Text
The visible text displayed in place of your SORTHEADER placeholder when no sorting is currently enabled.

Ascending Text
The visible text displayed in place of your SORTHEADER placeholder when the column is marked as rendering is Ascending order.

Descending Text
The visible text displayed in place of your SORTHEADER placeholder when the column is marked as rendering is Descending order.

Default Order
The default order of the data sorting upon first entry. Possible values are empty, ASC, ASC TOGGLE (Toggle only between ASC and DESC) DESC, and DESC TOGGLE (Toggle only between DESC and ASC).

Sort Index
The sort Index is used to replace the occurrence(s) of any {SORTHEADER,Index} tag where the Index would be the Sort Index contained in the sort tag.

Optional sortQuerystring
If this is nested under a Querystring such as [Action,Querystring]=DisplayList then "Action=DisplayList" needs to be included here.

Optional sortTargetId

NOTE:
If you are using table aliases within your query, the resulting sort will probably require these aliases as well. Make sure you place the complete name of the column within the confines of the sort tag, otherwise your query will cause errors upon execution.

Example:

<a {SORT, "Name","Name","Name <img  src='/images/up.gif'  align='absmiddle'/ >", "Name <img  src='/images/action_down.gif'  align='absmiddle'/ >",,"1","Action=[|Action,Querystring]&year=[year,Querystring:NUMBER]"} >{SORTHEADER,"1"}</a>

Average ( Ratings):
 
Want to help out?
 
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share