Skip to content

Interface

The DataSourceComponent component props.

Properties

PropertyTypeNotes
childrenReactNode | DataRenderFunction

If one of your children component's render depends on data source, please use this render function. Otherwise, even if the data record in the data source is changed, your children will not be re-rendered unless you connect the data source info in the children owner component to re-render the owner component.

dataSourceDataSource

Data source instance used by widget. Either useDataSource or dataSource is required.

errorStringstring

If the creation of the data source fails, this string will be shown.

forceRefreshVersionnumber

Increment forceRefreshVersion to force data source to load even if the query parameter does not change. Please note, all widgets using the data source will refresh, too.

localIdstring

Pass widgetId/localId if need to execute the query.

queryQueryParams

Query parameters of queriable data source. The component does not execute a query without query property. To execute a query without adding new filter, please use an empty object: {}.

queryAllboolean

Whether to load all the records page by page or not. Loading all records may take a long time and may cause performance issues. We recommend using the queryAllProgress and the queryAllSignal to show the progress and cancel the query if necessary.

queryAllProgressQueryProgressCallback

Only valid when queryAll is true. The function is called when the query is in progress.

queryAllSignalAbortSignal

Only valid when queryAll is true. The signal object is used to communicate with the query requests. See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal for more information.

queryCountboolean

Whether load record count when loading data records or not.

queryScopeQueryScope

Query scope defines which data is returned when the query is executed in addition to the query parameters.

useDataSourceIMUseDataSource

Data source used by widget. Either useDataSource or dataSource is required.

widgetIdstring

Pass widgetId/localId if need to execute the query.

children

optional
Interface Property

dataSource

optional
Interface Property

errorString

optional
Interface Property

forceRefreshVersion

optional
Interface Property

localId

optional
Interface Property

query

optional
Interface Property

queryAll

optional
Interface Property

queryAllProgress

optional
Interface Property

queryAllSignal

optional
Interface Property

queryCount

optional
Interface Property

queryScope

optional
Interface Property

useDataSource

optional
Interface Property

widgetId

optional
Interface Property

Methods

MethodReturnsNotes
onAllChildDataSourcesCreated(ds)void

Will call the function when all the child data sources are created. Please note the function is valid only when the current data source is data source set.

onCreateDataSourceFailed(err)void

Will call the function when fail to create the data source.

onDataSourceCreated(ds)void

Will call the function when the data source is created. Please note that some child data sources may not have been created by the time the current data source is created.

onDataSourceInfoChange(info, preInfo?)void

Will call the function when the data source info changes and on the component is mounted.

onDataSourceSchemaChange(schema, prevSchema?)void

Will call the function when the data source schema changes.

onDataSourceStatusChange(status, preStatus?)void

Will call the function when the data source status changes and on the component is mounted.

onQueryRequired(queryRequiredInfo, preQueryRequiredInfo?)void

This callback is triggered whenever the data source properties such as filters or gdbVersion change, and on the component is mounted. For example, adding a filter to data source will trigger the callback and selecting a record won't.

onSelectionChange(selection, preSelection?)void

Will call the function when the selected records change and on the component is mounted.

onAllChildDataSourcesCreated

optional
Interface Method
onAllChildDataSourcesCreated(dsDataSource): void

Will call the function when all the child data sources are created. Please note the function is valid only when the current data source is data source set.

Parameters
ParameterType
dsDataSource
Returns 
void

onCreateDataSourceFailed

optional
Interface Method
onCreateDataSourceFailed(errany): void

Will call the function when fail to create the data source.

Parameters
ParameterType
errany
Returns 
void

onDataSourceCreated

optional
Interface Method
onDataSourceCreated(dsDataSource): void

Will call the function when the data source is created. Please note that some child data sources may not have been created by the time the current data source is created.

Parameters
ParameterType
dsDataSource
Returns 
void

onDataSourceInfoChange

optional
Interface Method
onDataSourceInfoChange(infoIMDataSourceInfo, preInfo?IMDataSourceInfo): void

Will call the function when the data source info changes and on the component is mounted.

Parameters
ParameterType
infoIMDataSourceInfo
preInfoIMDataSourceInfo
Returns 
void

onDataSourceSchemaChange

optional
Interface Method
onDataSourceSchemaChange(schemaIMDataSourceSchema, prevSchema?IMDataSourceSchema): void

Will call the function when the data source schema changes.

Parameters
ParameterType
schemaIMDataSourceSchema
prevSchemaIMDataSourceSchema
Returns 
void

onDataSourceStatusChange

optional
Interface Method
onDataSourceStatusChange(statusDataSourceStatus, preStatus?DataSourceStatus): void

Will call the function when the data source status changes and on the component is mounted.

Parameters
ParameterType
statusDataSourceStatus
preStatusDataSourceStatus
Returns 
void

onQueryRequired

optional
Interface Method
onQueryRequired(queryRequiredInfoQueryRequiredInfo, preQueryRequiredInfo?QueryRequiredInfo): void

This callback is triggered whenever the data source properties such as filters or gdbVersion change, and on the component is mounted. For example, adding a filter to data source will trigger the callback and selecting a record won't.

Please note this callback will be valid only when the query prop is not used.

Parameters
ParameterType
queryRequiredInfoQueryRequiredInfo
preQueryRequiredInfoQueryRequiredInfo
Returns 
void

onSelectionChange

optional
Interface Method
onSelectionChange(selectionImmutableArray<string>, preSelection?ImmutableArray<string>): void

Will call the function when the selected records change and on the component is mounted.

The selection is shared between the main data source, data view, and local data source and local data view. So this callback will be invoked when selection is make on any of them.

Note that the local data source or local data view does not listen to the selection by default, you need to call setListenSelection(true) to enable it when you need to.

Parameters
ParameterType
selectionImmutableArray<string>
preSelectionImmutableArray<string>
Returns 
void

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.