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 4-15 lists actuate.data.Sorter functions.
Table 4-15  
actuate.data.Sorter.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);
}
actuate.data.Sorter.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);
  }
}
actuate.data.Sorter.setAscending
Syntax
void Sorter.setAscending(boolean ascending)
Sets the sort order to ascending or descending.
Parameters
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);
  }
}
actuate.data.Sorter.setColumnName
Syntax
void Sorter.setColumnName(string columnName)
Sets the column to sort on.
Parameters
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);
  }
}

Additional Links:

Copyright Actuate Corporation 2012