Interface
The DataSourceComponent component props.
Properties
| Property | Type | Notes |
|---|---|---|
children | ReactNode | 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. |
dataSource | DataSource | Data source instance used by widget. Either |
errorString | string | If the creation of the data source fails, this string will be shown. |
forceRefreshVersion | number | Increment |
localId | string | Pass widgetId/localId if need to execute the query. |
query | QueryParams | 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: {}. |
queryAll | boolean | 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 | QueryProgressCallback | Only valid when |
queryAllSignal | AbortSignal | Only valid when |
queryCount | boolean | Whether load record count when loading data records or not. |
queryScope | QueryScope | Query scope defines which data is returned when the query is executed in addition to the query parameters. |
useDataSource | IMUseDataSource | Data source used by widget. Either |
widgetId | string | Pass widgetId/localId if need to execute the query. |
Methods
| Method | Returns | Notes |
|---|---|---|
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
onAllChildDataSourcesCreated(ds: DataSource): voidWill 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
| Parameter | Type |
|---|---|
ds | DataSource |
Returns
voidonCreateDataSourceFailed
onCreateDataSourceFailed(err: any): voidWill call the function when fail to create the data source.
Parameters
| Parameter | Type |
|---|---|
err | any |
Returns
voidonDataSourceCreated
onDataSourceCreated(ds: DataSource): voidWill 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
| Parameter | Type |
|---|---|
ds | DataSource |
Returns
voidonDataSourceInfoChange
onDataSourceInfoChange(info: IMDataSourceInfo, preInfo?: IMDataSourceInfo): voidWill call the function when the data source info changes and on the component is mounted.
Parameters
| Parameter | Type |
|---|---|
info | IMDataSourceInfo |
pre | IMDataSourceInfo |
Returns
voidonDataSourceSchemaChange
onDataSourceSchemaChange(schema: IMDataSourceSchema, prevSchema?: IMDataSourceSchema): voidWill call the function when the data source schema changes.
Parameters
| Parameter | Type |
|---|---|
schema | IMDataSourceSchema |
prev | IMDataSourceSchema |
Returns
voidonDataSourceStatusChange
onDataSourceStatusChange(status: DataSourceStatus, preStatus?: DataSourceStatus): voidWill call the function when the data source status changes and on the component is mounted.
Parameters
| Parameter | Type |
|---|---|
status | DataSourceStatus |
pre | DataSourceStatus |
Returns
voidonQueryRequired
onQueryRequired(queryRequiredInfo: QueryRequiredInfo, preQueryRequiredInfo?: QueryRequiredInfo): voidThis 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
| Parameter | Type |
|---|---|
query | QueryRequiredInfo |
pre | QueryRequiredInfo |
Returns
voidonSelectionChange
onSelectionChange(selection: ImmutableArray<string>, preSelection?: ImmutableArray<string>): voidWill 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
| Parameter | Type |
|---|---|
selection | ImmutableArray<string> |
pre | ImmutableArray<string> |
Returns
void