Caplin Trader 4.7.1

Interface: module:caplin/grid/GridRowModel

module:caplin/grid/GridRowModel

The GridRowModel is one of the two models that are used within a grid assembly — the other being the module:caplin/grid/GridColumnModel. The row model allows row data to be accessed, and row events to be listened to. Classes that need to listen to row model events must implement the module:caplin/grid/GridRowModelListener interface, and register themselves for these events by calling module:caplin/grid/GridRowModel#addRowModelListener.

Although clients could choose to implement GridRowModel themselves when they wish to provide a new grid data-source (e.g. a row model that gets it's data by querying some custom web-service), it is expected that clients will use the generic module:caplin/grid/DataProviderRowModel, and instead implement module:caplin/grid/GridDataProvider to access any custom data &mdash this is much simpler than implementing the entire GridRowModel interface.

Implementations:
Implements:

Members

(static, readonly) FILTERING :int

A constant definition used with module:caplin/grid/GridRowModel#supportsFeature to allow row models to declare whether they support filtering.

Row models that do support filtering will need access to the module:caplin/grid/GridColumnModel they are working in tandem with (e.g. by having the column model as one of their constructor parameters) so that they can listen to the column model events — in particular module:caplin/grid/GridColumnModelListener#onFiltersChanged and module:caplin/grid/GridColumnModelListener#onApplyFilters.

Type:
  • int

(static, readonly) SORTING :int

A constant definition used with module:caplin/grid/GridRowModel#supportsFeature to allow row models to declare whether they support sorting.

Row models that do support sorting will need access to the module:caplin/grid/GridColumnModel they are working in tandem with (e.g. by having the column model as one of their constructor parameters) so that they can listen to the column model events — in particular module:caplin/grid/GridColumnModelListener#onSortColumnChanged.

Type:
  • int

Methods

addRow(sSubject)

Adds a row to the GridRowModel.
Parameters:
Name Type Description
sSubject String The RTTP subject identifier (e.g. /FX/EURUSD) for the new row.
Implementations:
  • module:caplin/grid/DataProviderRowModel#addRow

addRowModelListener(oRowModelListener)

Adds a listener to the row model, to be communicated of all row model events.
Parameters:
Name Type Description
oRowModelListener module:caplin/grid/GridRowModelListener The listener to add.
Implementations:
  • module:caplin/grid/DataProviderRowModel#addRowModelListener
See:

canReceive()

Implementations:
See:

canReceiveMultipleObjects()

Implementations:
See:

canReceiveObjects()

Implementations:
See:

clearFilterExpression(sFilterNameopt)

Removes the named filter expression from the row model.

The filter name parameter is optional. If no parameter is passed then the 'default' parameter expression will be removed.

Parameters:
Name Type Attributes Description
sFilterName String <optional>
The name of the filter expression to remove.
Implementations:
  • module:caplin/grid/DataProviderRowModel#clearFilterExpression

clearGroupByField()

Removes any grouping from the grid row model.
Implementations:
  • module:caplin/grid/DataProviderRowModel#clearGroupByField

clearSortRule()

Removes any sorting from the grid row model.
Implementations:
  • module:caplin/grid/DataProviderRowModel#clearSortRule

getAllFilterExpressions()

Returns a map of all filter expressions.

The returned map should not be modified by external clients as it is may be used internally by the row model class.

Implementations:
  • module:caplin/grid/DataProviderRowModel#getAllFilterExpressions

getFilterExpression(sFilterNameopt) → {module:caplin/grid/filter/FilterExpression}

Returns the named filter expression.

The filter name parameter is optional. If no parameter is passed then the 'default' parameter expression will be returned.

Parameters:
Name Type Attributes Description
sFilterName String <optional>
The name of the filter expression to remove.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getFilterExpression
Returns:
the filter with the specified name.
Type
module:caplin/grid/filter/FilterExpression

getGridDataProvider()

Returns the grid data provider which the row model listens to for data updates.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getGridDataProvider

getGroupByField() → {String}

Get the field, if one has been set, that is used to group the rows contained within row model.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getGroupByField
Returns:
a String, if one exists, or null otherwise.
Type
String

getIndexBySubject(sSubject)

Return the index of a subject.
Parameters:
Name Type Description
sSubject String The RTTP subject identifier (e.g. /FX/EURUSD) for the row.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getIndexBySubject

getLastReceiveFailureMessage()

Implementations:
See:

getPermissionKey() → {module:caplin/services/security/PermissionKey}

Returns a tuple containing the permissioning search query parameters that can be used to determine whether the user has the available permissions to view the data contained within this row model.

Row models whose data is not permissioned do not need to return a permissioning key, and may instead return null.

Implementations:
  • module:caplin/grid/DataProviderRowModel#getPermissionKey
See:
Returns:
the permissioning key tuple, or null
Type
module:caplin/services/security/PermissionKey

getRowData(nIndex) → {Object}

Returns the row data record at the specified index.
Parameters:
Name Type Description
nIndex int The index of the specified row.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getRowData
Returns:
the row data for the specified index.
Type
Object

getRowRangeSize()

Returns the size of the row range that is set with the setRowRange method.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getRowRangeSize

getSerializedState() → {String}

Invoked when the grid is saved.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getSerializedState
Returns:
An XML representation of the current state of this GridRowModel. This may be an empty string if the row model was configured by a parent grid definition.
Type
String

getSize() → {int}

Returns the number of rows available — not the number of rows that are currently visible.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getSize
Returns:
The number of rows available
Type
int

getSortRule() → {module:caplin/grid/sort/SortRule}

Get the rule, if one exists, that is used to sort the data within the row model.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getSortRule
Returns:
a SortRule, if one exists, or null otherwise.
Type
module:caplin/grid/sort/SortRule

getStartIndex() → {int}

Returns the start index of the row model which can be used to see how many rows have been scrolled.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getStartIndex
Returns:
The start index
Type
int

getSubjectId(nIndex) → {String}

Returns the RTTP subject identifier for the row at the specified index.

Row models whose rows correspond to objects that can be requested from a Liberator should use this method to make that information available — this may be true even for row models where the data itself does not come from a Liberator (e.g. a custom web-service) provided the row data corresponds to requestable objects within the Liberator.

Some decorators (such as the module:caplin/grid/decorator/DragDecorator require this information in order to allow dragging & dropping of row data into trade panels or custom grids. Row models whose data does not correspond to requestable objects within the Liberator can instead return null.

Parameters:
Name Type Description
nIndex int The index of the row being queried.
Implementations:
  • module:caplin/grid/DataProviderRowModel#getSubjectId
Returns:
the RTTP subject identifier (e.g. /FX/EURUSD) for the given row, or null otherwise.
Type
String

getSubjects()

Implementations:
Deprecated:
  • Use module:caplin/grid/GridRowModel##getVisibleSubjects instead.

    getTransformMode() → {String}

    Get the transform mode that determines how grid updates are pushed out from the data source.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#getTransformMode
    Returns:
    The transform mode - either 'snapshot' or 'live'
    Type
    String

    getVisibleSubjects() → {Array}

    Returns an array of subjects currently in the model (corresponding to visible rows), in order.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#getVisibleSubjects
    Returns:
    the visible subject
    Type
    Array

    pauseUpdates()

    Signals the GridRowModel to temporarily pause any updates to all RowModelListener instances.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#pauseUpdates
    See:

    receiveObjects()

    Implementations:
    See:

    removeRow(sSubject)

    Removes a row from the GridRowModel.
    Parameters:
    Name Type Description
    sSubject String The RTTP subject identifier (e.g. /FX/EURUSD) for the new row.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#removeRow

    removeRowModelListener(oRowModelListener)

    Removes a listener that no longer wishes to listen to row model events.
    Parameters:
    Name Type Description
    oRowModelListener module:caplin/grid/GridRowModelListener The listener to remove.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#removeRowModelListener
    See:

    removeRows(pSubjects)

    Removes a number of rows from the GridRowModel.
    Parameters:
    Name Type Description
    pSubjects String The RTTP subject identifiers of the rows to remove.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#removeRows

    resumeUpdates()

    Signals the GridRowModel to resume updates to any RowModelListener instances.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#resumeUpdates
    See:

    setFilterExpression(oFilterExpression, sFilterNameopt)

    Add a filter expression to this row model.

    The filter name parameter is optional. If no parameter is passed then this filter expression will be assumed to be 'default'.

    Parameters:
    Name Type Attributes Description
    oFilterExpression module:caplin/grid/filter/FilterExpression The filter expression to apply to this row model.
    sFilterName String <optional>
    The name that this filter expression will be known by.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#setFilterExpression

    setGroupByField(sFieldName)

    Sets the field to be used for grouping the rows within the row model.
    Parameters:
    Name Type Description
    sFieldName String The field name that will be used for grouping.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#setGroupByField

    setRowData(nIndex, mRowData)

    Method added to allow editing data inside grid. Sets the field value for the row with the specific index
    Parameters:
    Name Type Description
    nIndex String index id of the row to add field
    mRowData Map field maps to update
    Implementations:
    • module:caplin/grid/DataProviderRowModel#setRowData

    setRowRange(nStartIndex, nSize)

    Sets the start index and total number of rows that the module:caplin/grid/GridView is able to display, and hence the the row model should provide.
    Parameters:
    Name Type Description
    nStartIndex int The start index of the first row visible within the view.
    nSize int The number of rows visible within the view.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#setRowRange

    setSortRule(oSortRule)

    Set a rule that will be used to sort the data within the row model.
    Parameters:
    Name Type Description
    oSortRule module:caplin/grid/sort/SortRule The object containing the sort parameters.
    Implementations:
    • module:caplin/grid/DataProviderRowModel#setSortRule

    supportsFeature(nFeature)

    Determine whether this instance of GridRowModel supports a particular feature.
    Parameters:
    Name Type Description
    nFeature int the feature constant that is being queried.
    Implementations:
    See:

    terminateUpdates()

    Signals the GridRowModel to terminate all updates to any RowModelListener instances.

    This method is essentially the destructor for classes implementing GridRowModel, and is the opportunity to perform any clean-up that may be required.

    Implementations:
    • module:caplin/grid/DataProviderRowModel#terminateUpdates