DataSourceComponentProps

Interface

The DataSourceComponent component props.

Properties

PropertyTypeNotes
children
 optional 
DataRenderFunction | ReactNode

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 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
 optional 

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
 optional 
boolean

Whether query record count when query data records.

IMUseDataSource

Data source used by widget.

widgetId
 optional 
string

Pass widgetId/localId if need to execute the query.

children optional

children: DataRenderFunction | ReactNode

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.

forceRefreshVersion optional

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 optional

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 optional

queryCount: boolean

Whether query record count when query data records.

useDataSource

useDataSource: IMUseDataSource

Data source used by widget.

widgetId optional

widgetId: string

Pass widgetId/localId if need to execute the query.

For main data source or data view, please use widgetId. For local data source, please use localId. The recommended localId is: widgetId + ???

Methods

MethodReturnsNotes
onCreateDataSourceFailed(err)
 optional 
void

Failing to create data source will call the function.

onDataSourceCreated(ds)
 optional 
void

If one data source is used by mutiple widgets, every widget will receive the onDataSourceCreated callback.

onDataSourceInfoChange(info, preInfo?)
 optional 
void

Data source info changing will call the function.

onDataSourceSchemaChange(schema, prevSchema?)
 optional 
void

If data source schema is changed, will call the function.

onQueryRequired(queryRequiredInfo, preQueryRequiredInfo?)
 optional 
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.

onCreateDataSourceFailed optional

onCreateDataSourceFailed(errany): void

Failing to create data source will call the function.

Parameters
ParameterType
err
any
Returns 
void

onDataSourceCreated optional

onDataSourceCreated(dsDataSource): void

If one data source is used by mutiple widgets, every widget will receive the onDataSourceCreated callback.

Parameters
ParameterType
ds
DataSource
Returns 
void

onDataSourceInfoChange optional

onDataSourceInfoChange(infoIMDataSourceInfo, preInfo?IMDataSourceInfo): void

Data source info changing will call the function.

Parameters
ParameterType
info
IMDataSourceInfo
preInfo
IMDataSourceInfo
Returns 
void

onDataSourceSchemaChange optional

onDataSourceSchemaChange(schemaIMDataSourceSchema, prevSchema?IMDataSourceSchema): void

If data source schema is changed, will call the function.

Parameters
ParameterType
schema
IMDataSourceSchema
prevSchema
IMDataSourceSchema
Returns 
void

onQueryRequired optional

onQueryRequired(queryRequiredInfoQueryRequiredInfo, 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
ParameterType
queryRequiredInfo
QueryRequiredInfo
preQueryRequiredInfo
QueryRequiredInfo
Returns 
void

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