GridDataProvider
classes allow data from different data sources to be displayed within a grid when
used in conjunction with an instance of module:caplin/grid/DataProviderRowModel
. The GridDataProvider
interface is much simpler to implement than the full module:caplin/grid/GridRowModel
interface, and should allow
most, if not all, grid row models to be developed, and so is the preferred way of creating a
module:caplin/grid/GridRowModel
.
The sdk contains a set of generic data providers for retrieving different data types from the Caplin Platform
(implementations are listed below), it is also anticipated that customers may also need to create their own data
provider classes for accessing other forms of data, e.g. a data provider that accesses a custom web-service. So,
GridDataProvider
is the interface that customers wishing to have custom data displayed within a grid
must implement.
- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider
- module:caplin/grid/DummyGridDataProvider
- module:caplin/grid/PersonalGridDataProvider
- module:caplin/grid/RttpContainerGridDataProvider
- module:caplin/grid/SyntheticGridDataProvider
- module:caplin/grid/WebServiceGridDataProvider
- Implements:
Members
-
(static, readonly) FILTERING :int
-
A constant definition used with
module:caplin/grid/GridDataProvider#supportsFeature
to allow data providers to declare whether they support filtering.Data providers that do support filtering will need to correctly implement
module:caplin/grid/GridDataProvider#setFilters
.Type:
- int
-
(static, readonly) PAGING :int
-
A constant definition used with
module:caplin/grid/GridDataProvider#supportsFeature
to allow data providers to declare whether they support paging.Type:
- int
- Deprecated:
- This field is no longer used and all data providers should support paging.
-
(static, readonly) SORTING :int
-
A constant definition used with
module:caplin/grid/GridDataProvider#supportsFeature
to allow data providers to declare whether they support sorting.Data providers that do support sorting will need to correctly implement
module:caplin/grid/GridDataProvider#sortBy
.Type:
- int
Methods
-
addDataProviderListener(listener)
-
Adds a listener to the data provider, to be communicated of all data provider events.
Parameters:
Name Type Description listener
module:caplin/grid/GridDataProviderListener The listener to add. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#addDataProviderListener
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#addDataProviderListener
- module:caplin/grid/DummyGridDataProvider#addDataProviderListener
- module:caplin/grid/PersonalGridDataProvider#addDataProviderListener
- module:caplin/grid/RttpContainerGridDataProvider#addDataProviderListener
- module:caplin/grid/SyntheticGridDataProvider#addDataProviderListener
- module:caplin/grid/WebServiceGridDataProvider#addDataProviderListener
- See:
-
canReceive()
-
canReceiveMultipleObjects()
-
canReceiveObjects()
-
clearFilterExpression(filterName)
-
Remove a named filter expression. Once removed the data provider will reset itself to display the data without the removed filter.
Parameters:
Name Type Description filterName
string The name of the filter. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#clearFilterExpression
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#clearFilterExpression
- module:caplin/grid/PersonalGridDataProvider#clearFilterExpression
- module:caplin/grid/RttpContainerGridDataProvider#clearFilterExpression
- module:caplin/grid/WebServiceGridDataProvider#clearFilterExpression
-
clearGroupByField()
-
Removes any grouping from the grid row model.
- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#clearGroupByField
- module:caplin/grid/PersonalGridDataProvider#clearGroupByField
- module:caplin/grid/RttpContainerGridDataProvider#clearGroupByField
-
clearSortRule()
-
Removes any sorting from the grid row model.
- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#clearSortRule
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#clearSortRule
- module:caplin/grid/PersonalGridDataProvider#clearSortRule
- module:caplin/grid/RttpContainerGridDataProvider#clearSortRule
-
configureDataProvider(xmlConfigurationNode, isDataProviderDefinedByParent)
-
Allow the data provider to configure itself based on the XML attributes from the node used to configure the data provider.
Parameters:
Name Type Description xmlConfigurationNode
Element Access to the XML node that contains any configuration information the data provider needs to configure itself. isDataProviderDefinedByParent
boolean Informs the data provider whether its configuration came via inheritance, or was configured locally — this will affect how the data provider should behave when its module:caplin/grid/GridDataProvider#getSerializedState
method is invoked.- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#configureDataProvider
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#configureDataProvider
- module:caplin/grid/PersonalGridDataProvider#configureDataProvider
- module:caplin/grid/RttpContainerGridDataProvider#configureDataProvider
- module:caplin/grid/SyntheticGridDataProvider#configureDataProvider
- module:caplin/grid/WebServiceGridDataProvider#configureDataProvider
-
getAllFilterExpressions() → {map}
-
A map of all the filter expressions added to this data provider.
- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#getAllFilterExpressions
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getAllFilterExpressions
- module:caplin/grid/PersonalGridDataProvider#getAllFilterExpressions
- module:caplin/grid/RttpContainerGridDataProvider#getAllFilterExpressions
- module:caplin/grid/WebServiceGridDataProvider#getAllFilterExpressions
Returns:
A map ofmodule:caplin/grid/filter/FilterExpression
instances, if any exist, or an empty map otherwise.- Type
- map
-
getFilterExpression(filterName) → {module:caplin/grid/filter/FilterExpression}
-
Returns a named filter expression.
Parameters:
Name Type Description filterName
String The name of the filter to return — 'default' is the name given to filters generated from XML which lack the name attribute. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#getFilterExpression
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getFilterExpression
- module:caplin/grid/PersonalGridDataProvider#getFilterExpression
- module:caplin/grid/RttpContainerGridDataProvider#getFilterExpression
- module:caplin/grid/WebServiceGridDataProvider#getFilterExpression
Returns:
AFilterExpression
, if one exists, ornull
otherwise. -
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/dataprovider/ChainedGridDataProvider#getGroupByField
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getGroupByField
- module:caplin/grid/PersonalGridDataProvider#getGroupByField
- module:caplin/grid/RttpContainerGridDataProvider#getGroupByField
- module:caplin/grid/WebServiceGridDataProvider#getGroupByField
Returns:
a String, if one exists, ornull
otherwise.- Type
- string
-
getLastReceiveFailureMessage()
-
- Implementations:
- module:caplin/grid/PersonalGridDataProvider#getLastReceiveFailureMessage
- See:
-
getPermissionKey() → {module:caplin/services/security/PermissionKey|null}
-
Returns a permissioning key tuple that can be used to query the permissioning system to determine whether the user is permitted to access the data that this data provider will be providing.
Data providers whose data is not permissioned need not return a permissioning key.
- Implementations:
- module:caplin/grid/PersonalGridDataProvider#getPermissionKey
- module:caplin/grid/RttpContainerGridDataProvider#getPermissionKey
- module:caplin/grid/WebServiceGridDataProvider#getPermissionKey
Returns:
a permissioning key, ornull
.- Type
- module:caplin/services/security/PermissionKey | null
-
getSerializedState() → {string}
-
Invoked when the grid row model needs to save the state of this data provider. It returns an XML string representation of the state.
This interface differs from the implemented
module:caplin/core/Serializable
interface in the following way.If the state of the data provider has changed since deserialization, or the data provider state has ever changed in the past (i.e. the
isDataProviderDefinedByParent
passed within themodule:caplin/grid/GridDataProvider#configureDataProvider
method wasfalse
, then the data provider should return a serialized representation of itself. If this is not the case, however, the data provider should otherwise returnnull
.Example:
caplin.grid.RttpContainerGridDataProvider.prototype.getSerializedState = function() { if (this.m_bStateChanged || !this.m_bDataProviderDefinedByParent) { var sEncodedContainerName = caplin.core.XmlUtility.encodeValue(this.m_sOriginalContainerName); return '
\n'; } return null; }; - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#getSerializedState
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getSerializedState
- module:caplin/grid/PersonalGridDataProvider#getSerializedState
- module:caplin/grid/RttpContainerGridDataProvider#getSerializedState
- module:caplin/grid/WebServiceGridDataProvider#getSerializedState
Throws:
-
if this method is not implemented by the subclass.
- Type
- module:br/Errors.UnimplementedInterfaceError
Returns:
An XML string representation of the state of this component, ornull
if there have not been any changes to the data provider. Must not beundefined
.- Type
- string
-
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/dataprovider/ChainedGridDataProvider#getSortRule
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getSortRule
- module:caplin/grid/PersonalGridDataProvider#getSortRule
- module:caplin/grid/RttpContainerGridDataProvider#getSortRule
- module:caplin/grid/SyntheticGridDataProvider#getSortRule
- module:caplin/grid/WebServiceGridDataProvider#getSortRule
Returns:
a SortRule, if one exists, ornull
otherwise. -
getStartIndex() → {int|null}
-
Returns the start index that is set on the Data Provider via the
module:caplin/grid/GridDataProvider#setRowRange
method.- Implementations:
- module:caplin/grid/RttpContainerGridDataProvider#getStartIndex
Returns:
A number representing the start index the data provider has been set at, ornull
if not yet set.- Type
- int | null
-
getSubjectIdentifiers(snapshotListener)
-
Returns the array of subject identifiers provided by the data provider.
This will include all subject identifiers, not just those within the current view.
Parameters:
Name Type Description snapshotListener
module:caplin/grid/GridDataProviderSnapshotListener - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#getSubjectIdentifiers
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getSubjectIdentifiers
- module:caplin/grid/PersonalGridDataProvider#getSubjectIdentifiers
- module:caplin/grid/RttpContainerGridDataProvider#getSubjectIdentifiers
-
getSuccessMessage()
-
- Implementations:
- module:caplin/grid/PersonalGridDataProvider#getSuccessMessage
- See:
-
getTransformMode() → {string}
-
Get the transform mode that determines how grid updates are pushed out from the data source.
- Implementations:
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#getTransformMode
- module:caplin/grid/PersonalGridDataProvider#getTransformMode
- module:caplin/grid/RttpContainerGridDataProvider#getTransformMode
Returns:
The transform mode - either 'snapshot' or 'live'- Type
- string
-
injectData(subject, fieldData)
-
Injects a map of Data consisting of field_name:value pairs into a record given by its subject.
The GridDataProvider will notify all its observers about a record change with this data
Parameters:
Name Type Description subject
string fieldData
map - Implementations:
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#injectData
- module:caplin/grid/RttpContainerGridDataProvider#injectData
-
pauseUpdates()
-
Signals the
GridDataProvider
to temporarily pause updates to anyGridDataProviderListener
instances.This method is invoked as a consequence of
module:caplin/grid/DataProviderRowModel#pauseUpdates
being invoked. This method is a hint only, as themodule:caplin/grid/DataProviderRowModel
will also perform caching of updates so they do not need to be rendered to the screen. By implementing pausing at the data provider level, however, additional processor usage can be conserved allowing multiple sheets to be opened without increasing the burden placed on they processor.- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#pauseUpdates
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#pauseUpdates
- module:caplin/grid/PersonalGridDataProvider#pauseUpdates
- module:caplin/grid/RttpContainerGridDataProvider#pauseUpdates
- module:caplin/grid/WebServiceGridDataProvider#pauseUpdates
- See:
-
- module:caplin/grid/GridDataProvider#resumeUpdates
- module:caplin/grid/DataProviderRowModel#pauseUpdates
-
receiveObjects()
-
- Implementations:
- module:caplin/grid/PersonalGridDataProvider#receiveObjects
- See:
-
removeDataProviderListener(listener)
-
Removes a
GridDataProviderListener
that no longer wishes to listen to data updates.Parameters:
Name Type Description listener
module:caplin/grid/GridDataProviderListener The listener to remove. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#removeDataProviderListener
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#removeDataProviderListener
- module:caplin/grid/DummyGridDataProvider#removeDataProviderListener
- module:caplin/grid/PersonalGridDataProvider#removeDataProviderListener
- module:caplin/grid/RttpContainerGridDataProvider#removeDataProviderListener
- module:caplin/grid/SyntheticGridDataProvider#removeDataProviderListener
- module:caplin/grid/WebServiceGridDataProvider#removeDataProviderListener
- See:
-
resumeUpdates()
-
Signals the
GridDataProvider
to resume updates to allGridDataProviderListener
instances.- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#resumeUpdates
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#resumeUpdates
- module:caplin/grid/PersonalGridDataProvider#resumeUpdates
- module:caplin/grid/RttpContainerGridDataProvider#resumeUpdates
- module:caplin/grid/WebServiceGridDataProvider#resumeUpdates
- See:
-
- module:caplin/grid/GridDataProvider#pauseUpdates
- module:caplin/grid/DataProviderRowModel#resumeUpdates
-
setFilterExpression(filterExpression, filterName)
-
Set a filter expression on this data provider. This will filter the grid data according to the operator and values of the filter expression.
Parameters:
Name Type Description filterExpression
module:caplin/grid/filter/FilterExpression A filter expression to apply to this data provider. filterName
string The name of the filter. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setFilterExpression
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setFilterExpression
- module:caplin/grid/PersonalGridDataProvider#setFilterExpression
- module:caplin/grid/RttpContainerGridDataProvider#setFilterExpression
- module:caplin/grid/WebServiceGridDataProvider#setFilterExpression
-
setFilters(activeColumnFilters, allColumns)
-
Informs the
GridDataProvider
of the currently active column filters.Parameters:
Name Type Description activeColumnFilters
Array An array of all the currently active module:caplin/grid/GridColumnFilter
instances.allColumns
map A map of all GridView's column module:caplin/grid/GridColumn
instances.- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setFilters
- module:caplin/grid/PersonalGridDataProvider#setFilters
- module:caplin/grid/RttpContainerGridDataProvider#setFilters
-
setGridView(gridView)
-
The opportunity for the data provider to add itself as a listener to the the
module:caplin/grid/GridView
as a renderer event listener.Parameters:
Name Type Description gridView
module:caplin/grid/GridView The view that the data provider/controller can use to communicate with the View/Model. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setGridView
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setGridView
- module:caplin/grid/PersonalGridDataProvider#setGridView
-
setGroupByField(fieldName)
-
Sets the field to be used for grouping the rows within the row model.
Parameters:
Name Type Description fieldName
string The field name that will be used for grouping. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setGroupByField
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setGroupByField
- module:caplin/grid/PersonalGridDataProvider#setGroupByField
- module:caplin/grid/RttpContainerGridDataProvider#setGroupByField
-
setRequiredFields(fieldNames)
-
Sets the required fields that this data provider should provide within each record.
Parameters:
Name Type Description fieldNames
Array.<string> A list of field names. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setRequiredFields
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setRequiredFields
- module:caplin/grid/DummyGridDataProvider#setRequiredFields
- module:caplin/grid/PersonalGridDataProvider#setRequiredFields
- module:caplin/grid/RttpContainerGridDataProvider#setRequiredFields
- module:caplin/grid/SyntheticGridDataProvider#setRequiredFields
- module:caplin/grid/WebServiceGridDataProvider#setRequiredFields
-
setRowData(subject, fieldData)
-
Updates the data on editable row. Currently the data received is updated in a local cache and merged with received data works only if supported by implementing class (bEditable is set to true)
Parameters:
Name Type Description subject
String subject (objectName) of the row to be updated fieldData
Object map with field name and values to be updated for the subject specified - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setRowData
- module:caplin/grid/PersonalGridDataProvider#setRowData
- module:caplin/grid/RttpContainerGridDataProvider#setRowData
-
setRowRange(startIndex, size)
-
Sets the start index and total number of rows that this
GridDataProvider
should supply when notifying listeners of row updates — this will change as the view is scrolled or resized to reveal different rows.Parameters:
Name Type Description startIndex
int The start index of the first row within the range. size
int The number of rows within the range. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setRowRange
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setRowRange
- module:caplin/grid/DummyGridDataProvider#setRowRange
- module:caplin/grid/PersonalGridDataProvider#setRowRange
- module:caplin/grid/RttpContainerGridDataProvider#setRowRange
- module:caplin/grid/SyntheticGridDataProvider#setRowRange
- module:caplin/grid/WebServiceGridDataProvider#setRowRange
- See:
-
setSortRule(sortRule)
-
Set a rule that will be used to sort the data within the row model.
Parameters:
Name Type Description sortRule
module:caplin/grid/sort/SortRule The object containing the sort parameters. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#setSortRule
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#setSortRule
- module:caplin/grid/PersonalGridDataProvider#setSortRule
- module:caplin/grid/RttpContainerGridDataProvider#setSortRule
-
setTransformMode(transformMode)
-
Sets the update mode that determines how grid updates are pushed out from the data source.
Parameters:
Name Type Description transformMode
string The update mode to use. - Implementations:
- module:caplin/grid/PersonalGridDataProvider#setTransformMode
- module:caplin/grid/RttpContainerGridDataProvider#setTransformMode
-
supportsFeature(feature)
-
Determine whether this instance of
GridDataProvider
supports a particular feature.Parameters:
Name Type Description feature
int the feature constant that is being queried. - Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#supportsFeature
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#supportsFeature
- module:caplin/grid/DummyGridDataProvider#supportsFeature
- module:caplin/grid/PersonalGridDataProvider#supportsFeature
- module:caplin/grid/RttpContainerGridDataProvider#supportsFeature
- module:caplin/grid/WebServiceGridDataProvider#supportsFeature
- See:
-
terminateUpdates()
-
Signals the
GridDataProvider
to permanently terminate updates to anyGridDataProviderListener
instances.This method is essentially the destructor for classes implementing
GridDataProvider
, and is the opportunity to perform any clean-up that may be required.- Implementations:
- module:caplin/grid/dataprovider/ChainedGridDataProvider#terminateUpdates
- module:caplin/grid/dataprovider/sljs/SLJSContainerDataProvider#terminateUpdates
- module:caplin/grid/PersonalGridDataProvider#terminateUpdates
- module:caplin/grid/RttpContainerGridDataProvider#terminateUpdates
- module:caplin/grid/WebServiceGridDataProvider#terminateUpdates