Functions
-
getEnhancedDataProvider<K, D>(dataProvider, capabilityConfigurations) : {DataProvider.<K, D>}
-
Utility function that enhances a base DataProvier with additional capabilities by wrapping it in other DataProviders.
Parameters:
Name Type Description dataProvider
DataProvider.<K, D> The base DataProvider to enhance. If this is a TreeDataProvider, the base DataProvider and each DataProvider returned by getChildDataProvider will be enhanced.
capabilityConfigurations
CapabilityConfigurations Capabilities being requested. The capabilities of the base DataProvider will be checked to see if it already supports at least the requested capabilities. Any capability it doesn't support will be provided by wrapping DataProviders. For example, if "visitedByCurrentIterator" caching is requested for the fetchFirst capability, and the base DataProvider already supports "all" or "visitedByCurrentIterator" caching, there is no need to wrap it.
Returns:
The outermost wrapping DataProvider. This may be the base DataProvider itself if it already supports all of the requested capabilities.
- Type
- DataProvider.<K, D>
Type Definitions
-
CapabilityConfigurations
-
Properties:
Name Type Argument Description eventFiltering
{type?: "iterator"} <optional>
If "iterator" is specified for the "type" property, enhance the base DataProvider to filter mutate events to hide items that are not within range of items that have been returned by its iterators. fetchFirst
{caching?: "visitedByCurrentIterator", totalFilteredRowCount?: "exact"} <optional>
If "visitedByCurrentIterator" is specified for the "caching" property, enhance the base DataProvider to cache the results returned by its iterators. Cached results, if available, can be returned when fetchByKeys, fetchByOffset, or containsKeys is called on the enhanced DataProvider. If "exact" is specified for the "totalFilteredRowCount" property, enhance the base DataProvider to include totalFilteredRowCount in the iterator results. Note that this enhancement can be expensive because all rows will be iterated to determine totalFilteredRowCount.
Examples
const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider, { eventFiltering: {type: "iterator"}, } );
const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider, { fetchFirst: {caching: "visitedByCurrentIterator"} } );
const enhancedDataProvider = getEnhancedDataProvider(baseDataProvider, { eventFiltering: {type: "iterator"}, fetchFirst: {caching: "visitedByCurrentIterator"} } );