Usage
Signature:
interface DataGridProvider<D>
Generic Parameters
Parameter Description D Type of Data
Typescript Import Format
//To use this interface, import as below.
import {DataGridProvider} from "ojs/ojdatagridprovider";
For additional information visit:
Methods
-
addEventListener(eventType: string, listener: EventListener): void
-
Add a callback function to listen for a specific event type. Currently supported events are DataGridProviderRefreshEvent, DataGridProviderAddEvent, DataGridProviderRemoveEvent, and DataGridProviderUpdateEvent.
Parameters:
Name Type Description eventType
string The event type to listen for. listener
EventListener The callback function that receives the event notification. -
fetchByOffset(parameters: FetchByOffsetGridParameters): Promise<FetchByOffsetGridResults<D>>
-
Fetch data for specified fetch regions by offset and count.
Parameters passed in will indicate which regions of the data to fetch.
Inspect FetchByOffsetGridParameters and FetchByOffsetGridResults for details on expected values.
The results for the fetch should contain every item which is within the bounds of the fetch at all. This includes header or cell items that have extents that cross the boundary of the fetch.
Results allows for categorical iteration of fetch regions, but not offset/count iteration, via the next property.
If a the DataGridProvider supports mutations it should implement a versioning strategy to indicate the version of returned result set.
Parameters:
Name Type Description parameters
FetchByOffsetGridParameters fetch by offset parameters - Since:
- 11.0.0
Returns:
Returns Promise which resolves to FetchByOffsetGridResults.
- Type
- Promise.<FetchByOffsetGridResults>
-
getCapability(capabilityName: string): any
-
Determines whether this DataGridProvider defines a certain feature.
Parameters:
Name Type Description capabilityName
string capability name. Defined capability names are: "version". - Since:
- 11.0.0
Returns:
capability information or null if undefined
- If capabilityName is "version", returns a VersionCapability object.
- Type
- any
Example
let capabilityInfo = dataGridProvider.getCapability('version'); if (capabilityInfo.implementation == 'monotonicallyIncreasing') { // the DataGridProvider supports monotonicallyIncreasing for version ...
-
isEmpty(): 'yes' | 'no' | 'unknown'
-
Returns a string that indicates if this DataGridProvider is empty. Valid values are:
- "yes": this DataGridProvider is empty.
- "no": this DataGridProvider is not empty.
- "unknown": it is not known if this DataGridProvider is empty until a fetch is made.
- Since:
- 11.0.0
Returns:
string that indicates if this DataGridProvider is empty
- Type
- "yes" | "no" | "unknown"
Example
let isEmpty = dataGridProvider.isEmpty(); console.log('DataGridProvider is empty: ' + isEmpty);
-
removeEventListener(eventType: string, listener: EventListener): void
-
Remove a listener previously registered with addEventListener.
Parameters:
Name Type Description eventType
string The event type that the listener was registered for. listener
EventListener The callback function that was registered.