DataSourceComponentProps

Interface

The DataSourceComponent component props.

Properties

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

onCreateDataSourceFailed optional
onCreateDataSourceFailed(errany): void

Failing to create data source will call the function.

Parameters
  • errany
Returns 
void
onDataSourceCreated optional
onDataSourceCreated(dsDataSource): void

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

Parameters
Returns 
void
onDataSourceInfoChange optional
onDataSourceInfoChange(infoIMDataSourceInfo, preInfo?IMDataSourceInfo): void

Data source info changing will call the function.

Parameters
  • infoIMDataSourceInfo
  • preInfoIMDataSourceInfooptional 
Returns 
void
onDataSourceSchemaChange optional
onDataSourceSchemaChange(schemaIMDataSourceSchema, prevSchema?IMDataSourceSchema): void

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

Parameters
  • schemaIMDataSourceSchema
  • prevSchemaIMDataSourceSchemaoptional 
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
Returns 
void

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