Class actuate.data.Sorter
Description
Specifies the conditions for sorting data as it is returned by a request or stored temporarily in a local ResultSet object. The sort arranges rows based on the value of a specified column.
Constructor
Syntax
actuate.data.Sorter(string columnName, boolean ascending)
Constructs a sorter object.
Parameters
columnName
String. The name of the column to sort.
ascending
Boolean. True sets sorting to ascending. False sets sorting to descending.
Function summary
Table 44‑15 lists actuate.data.Sorter functions.
Table 44‑15 actuate.data.Sorter functions 
Function
Description
Returns the column name
Returns true if the current sorting is ascending
Sets the sort order to ascending or descending
Sets the column to which this sorter applies
getColumnName
Syntax
string Sorter.getColumnName( )
Returns the name of the column to sort on.
Returns
String. The column name.
Example
This example displays an alert box that contains the column name currently being sorted on:
function showMyColumnName(mySorter){
var sortColName = mySorter.getColumnName( );
alert(sortColName);
}
isAscending
Syntax
boolean Sorter.isAscending( )
Returns true if the current sort order is ascending. Returns false if the current order is descending.
Returns
Boolean. True indicates ascending. False indicates descending.
Example
This example checks if the current sort order is ascending. When the current sort order is descending, this code sets the order to ascending:
function makeAscending(mySort){
if (mySort.isAscending( )) {
return;
} else {
mySort.setAscending(true);
}
}
setAscending
Syntax
void Sorter.setAscending(boolean ascending)
Sets the sort order to ascending or descending.
Parameter
ascending
Boolean. True sets the sort order to ascending. False sets the sort order to descending.
Example
This example checks if the current sort order is descending. When the current sort order is ascending, this code sets the order to descending:
function makeAscending(mySort){
if (mySort.isAscending( )) {
return;
} else {
mySort.setAscending(true);
}
}
setColumnName
Syntax
void Sorter.setColumnName(string columnName)
Sets the column to sort on.
Parameter
columnName
String. The column name.
Example
This example makes the current sorter arrange the result set ascending by the Sales column:
function makeAscendingOnSales(mySort){
mySort.setColumnName("Sales");
if (mySort.isAscending( )) {
return;
} else {
mySort.setAscending(true);
}
}