Sort

Description

Sorts the rows in a Web DataWindow client control using the DataWindow’s current sort criteria.

Applies to

Web DataWindow client control

Syntax

number objdwcontrol.Sort ( ) 

Argument

Description

objdwcontrol

A reference to a Web DataWindow client control

Returns

Returns 1 if it succeeds and -1 if an error occurs.

Usage

Sort uses the current sort criteria for the DataWindow. To change the sort criteria, use the SetSort method. The SetSort method is equivalent to using the Sort command on the Rows menu of the DataWindow painter. If you do not call SetSort to set the sort criteria before you call Sort, Sort uses the sort criteria specified in the DataWindow object definition.

Calling Sort causes the page to be reloaded.

All methods that reload the page perform an AcceptText before sending data back to the server. If the method fails (returns -1), this means that pending data changes were not accepted and nothing was sent back to the server. In this situation the ItemError event occurs.


Built-in client-side sorting

In Web DataWindows that use the Grid presentation style and the XML rendering format, a client-side sort can be performed with no coding. The order of numeric or text-based data values in a DataWindow column changes when the user clicks the column header. When the user moves the mouse over a column header, the cursor changes automatically to the Hand style to provide a cue to the user that sorting can be performed on that column.

This sorting functionality is based on client-side XSLT processing. For text-based sorting, the rules for sorting are language dependent, and are therefore controlled by the local language of the client computer running the XSLT processor. A white paper describing implementation details of language-dependent, text-based sorting is available on the Unicode Consortium Web site.

Because the sorting functionality is based on client-side XSLT processing, changing the order of items in a column does not force a page refresh. The sort functionality is not available with HTML or XHTML DataWindows, or with XML DataWindows that have non-grid presentation styles.