DataSourceComponentProps
Interface
The DataSourceComponent component props.
Properties
Property | Type | Notes |
---|---|---|
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. | |
number | Increment | |
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: {}. | ||
boolean | Whether query record count when query data records. | |
Data source used by widget. | ||
string | Pass widgetId/localId if need to execute the query. |
forceRefreshVersion
forceRefreshVersion: number
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.
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: {}.
queryCount
queryCount: boolean
Whether query record count when query data records.
useDataSource
Interface PropertyuseDataSource: IMUseDataSource
Data source used by widget.
Methods
Method | Returns | Notes |
---|---|---|
void | Failing to create data source will call the function. | |
void | If one data source is used by mutiple widgets, every widget will receive the onDataSourceCreated callback. | |
onDataSourceInfoChange(info, preInfo?) | void | Data source info changing will call the function. |
onDataSourceSchemaChange(schema, prevSchema?) | void | If data source schema is changed, will call the function. |
onDataSourceStatusChange(status, preStatus?) | void | When then data source status changes, this function will be called. |
onQueryRequired(queryRequiredInfo, preQueryRequiredInfo?) | void | Widgets may not pass in |
onSelectionChange(selection, preSelection?) | void | Selected records change will call the function. |
onCreateDataSourceFailed
onCreateDataSourceFailed(err: any): void
Failing to create data source will call the function.
Parameters
Parameter | Type |
---|---|
err | any |
Returns
void
onDataSourceCreated
onDataSourceCreated(ds: DataSource): void
If one data source is used by mutiple widgets, every widget will receive the onDataSourceCreated callback.
Parameters
Parameter | Type |
---|---|
ds | DataSource |
Returns
void
onDataSourceInfoChange
onDataSourceInfoChange(info: IMDataSourceInfo, preInfo?: IMDataSourceInfo): void
Data source info changing will call the function.
Parameters
Parameter | Type |
---|---|
info | IMDataSourceInfo |
pre | IMDataSourceInfo |
Returns
void
onDataSourceSchemaChange
onDataSourceSchemaChange(schema: IMDataSourceSchema, prevSchema?: IMDataSourceSchema): void
If data source schema is changed, will call the function.
Parameters
Parameter | Type |
---|---|
schema | IMDataSourceSchema |
prev | IMDataSourceSchema |
Returns
void
onDataSourceStatusChange
onDataSourceStatusChange(status: DataSourceStatus, preStatus?: DataSourceStatus): void
When then data source status changes, this function will be called.
Parameters
Parameter | Type |
---|---|
status | DataSourceStatus |
pre | DataSourceStatus |
Returns
void
onQueryRequired
onQueryRequired(queryRequiredInfo: QueryRequiredInfo, preQueryRequiredInfo?: QueryRequiredInfo): void
Widgets may not pass in query
props to load records into data source instance.
In this case, widgets still need to listen to data source changes to refresh themselves.
This callback is triggered whenever the data source properties such as filters or gdbVersion change.
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
void
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.
See here for the difference between parent and owner context: https://gist.github.com/jimfb/0eb6e61f300a8c1b2ce7.