Actuate JavaScript API classes : Class actuate.data.Sorter

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 column name.

ascending

Boolean. True sets sorting to ascending. False sets sorting to descending.

Function summary

Table 4-14 lists actuate.data.Sorter functions.

actuate.data.Sorter.getColumnName

Syntax

string Sorter.getColumnName( )

Returns the name of the column to sort on.

Returns

String.

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.

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 sorter to apply to the column specified by the columnName parameter.

Parameters

columnName

String. The column name.

Example

This example makes the current sorter arrange the result set ascending by the Sales column.

function makeAscendingSales(mySort){
  mySort.setColumnName("Sales");
  if (mySort.isAscending( )) {
    return;
  } else {
    mySort.setAscending(true);
  }
}

(c) Copyright Actuate Corporation 2011