Caplin Trader 5.1.0

Interface: module:ct-grid/GridRowModelListener

module:ct-grid/GridRowModelListener

GridRowModelListener defines an interface for classes that wish to listen to GridRowModel events.

Methods

onAllDataReceived()

This callback is invoked when data has been received for all requested rows

onRowContentsChanged(indices, updates)

This call-back is invoked when the content for one or more rows change.

While the updates attribute contains only those fields that have changed since the last update, you can instead use the module:ct-grid/GridRowModel#getRowData method if you need to retrieve the complete list of name/value pairs for any given row.

Parameters:
Name Type Description
indices Array

The list of row indices for which the content has changed.

updates Array.<Object>

A list of name/value pair maps (one for each row index) that contains the field updates for this row.

onRowDataReceived()

This callback is invoked once a response is received for the requested data.

onRowDataRequested()

This callback is invoked when a request for data has been initiated.

onRowDataUnavailable(sReason)

This callback is invoked when the request for data failed, for example due to an issue retrieving data from the server.

If the request was successful, but did not return any rows, then the module:ct-grid/GridRowModelListener#onRowDataReceived method will be invoked followed by module:ct-grid/GridRowModelListener#onSizeChanged with a new size of 0.

Parameters:
Name Type Description
sReason String

A brief description of what the error is. The enumeration module:ct-grid/RowDataUnavailable provides a list of the possible values.

onRowModelStateChanged()

This callback is invoked when the state of the row model has changed such that it is now fundamentally different to its initial configured state. A GUI could listen to this event to determine when to show an indication that the grid has changed and needs to be saved for the change to be persisted between sessions.

onRowStructureChanged(indices)

This call-back is invoked when the subject-identifiers for one or more rows change.

Whereas module:ct-grid/GridRowModelListener#onRowContentsChanged is used to denote content change within pre-existing subjects, this method signifies that there are data changes, but that they are not updates, but completely new replacement data corresponding to new subjects. The module:ct-grid/GridRowModel#getSubjectId method can be used to get the subject identifier corresponding to a particular row.

Parameters:
Name Type Description
indices Array

The list of row indices for which the subject has changed.

onSizeChanged(nNewSize, nOldSize)

This call-back is invoked when the total number of rows available changes — this is not the number being displayed.

Parameters:
Name Type Description
nNewSize int

The new number of rows contained within the grid.

nOldSize int

The old number of rows that were contained within the grid. This will be undefined the first time this method is called.

onStartIndexChanged(nNewStartIndex)

Callback that occurs when the total number of available rows is updated to be smaller than the maximum index currently displayed.

Parameters:
Name Type Description
nNewStartIndex int

The new start index.