Caplin Trader 5.1.0

Class: module:ct-grid/GridRowSelectionModel

module:ct-grid/GridRowSelectionModel(gridView)

new module:ct-grid/GridRowSelectionModel(gridView)

Constructs a new GridRowSelectionModel with the specified arguments.

Parameters:
Name Type Description
gridView module:ct-grid/GridView

The grid to which the row selections will apply.

The row selection model provides programmatic access to the row selections performed by the user. It is also the mechanism by which the default user interface (via the SelectionDecorator decorator) allows user row selection in the first place. An alternative row selection paradigm could be achieved by replacing this decorator with some other decorator.

The methods within this class are cumulative rather than definitive. For example, if you invoke module:ct-grid/GridRowSelectionModel#selectRowRange twice for two distinct row ranges, then both row ranges will be selected. The module:ct-grid/GridRowSelectionModel#deselectAllRows method can be used prior to some other method to create a single definitive selection.

Implements:

Methods

addRowSelectionListener(listener)

Adds a listener to the row selection model, to be communicated of all row selection events.

Parameters:
Name Type Description
listener module:ct-grid/GridRowSelectionModelListener

The object nominating to receive row selection call-backs.

deselectAllRows()

Deselect all rows.

deselectRow(subject)

Deselect the given row.

Parameters:
Name Type Description
subject String

The subject identifier of the row to be deselected.

deselectRowRange(sFromSubject, sToSubject)

Deselect a given row range.

Parameters:
Name Type Description
sFromSubject String

The subject identifier of the first row to be deselected.

sToSubject String

The subject identifier of the last row to be deselected.

getSelectedRows() → {Array}

Retrieve a list of the currently selected rows.

Returns:

An array of the subject identifiers for the currently selected rows.

Type
Array

hasSelectedRows() → {boolean}

Specifies whether there are any rows selected or not.

Returns:

true if there are no rows selected, and false otherwise.

Type
boolean

isSelectedRow(subject) → {boolean}

Determines whether a given row is selected or not.

Parameters:
Name Type Description
subject String

The subject identifier of the row in question.

Returns:

true if the row is selected, and false otherwise.

Type
boolean

removeRowSelectionListener(listener)

Remove a previously registered row selection listener.

Parameters:
Name Type Description
listener module:ct-grid/GridRowSelectionModelListener

The row selection listener to be removed.

selectAllRows()

Select all rows within the entire grid.

selectRow(subject)

Select the given row.

Parameters:
Name Type Description
subject String

The subject identifier of the row to be selected.

selectRowRange(sFromSubject, sToSubject)

Select a given row range.

Parameters:
Name Type Description
sFromSubject String

The subject identifier of the first row to be selected.

sToSubject String

The subject identifier of the last row to be selected.