DataSourceComponentProps

Interface

The DataSourceComponent component props.

Properties

PropertyTypeNotes
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.

string

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

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.

(dsDataSource) => void
(errany) => void
(dsDataSource) => void
(infoIMDataSourceInfo, preInfo?IMDataSourceInfo) => void
(schemaIMDataSourceSchema, prevSchema?IMDataSourceSchema) => void
(statusDataSourceStatus, preStatus?DataSourceStatus) => void
(queryRequiredInfoQueryRequiredInfo, preQueryRequiredInfo?QueryRequiredInfo) => void
(selectionImmutableArray<string>, preSelection?ImmutableArray<string>) => void

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. Either useDataSource or dataSource is required.

string

Pass widgetId/localId if need to execute the query.

children

optional
Interface Property
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.

errorString

optional
Interface Property
errorString: string

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

forceRefreshVersion

optional
Interface Property
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.

onAllChildDataSourcesCreated

optional
Interface Property
onAllChildDataSourcesCreated: (dsDataSource) => void
Type declaration
    function(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
    ds
    DataSource
    Returns 
    void

onCreateDataSourceFailed

optional
Interface Property
onCreateDataSourceFailed: (errany) => void
Type declaration
    function(errany): void

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

    Parameters
    ParameterType
    err
    any
    Returns 
    void

onDataSourceCreated

optional
Interface Property
onDataSourceCreated: (dsDataSource) => void
Type declaration
    function(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
    ds
    DataSource
    Returns 
    void

onDataSourceInfoChange

optional
Interface Property
onDataSourceInfoChange: (infoIMDataSourceInfo, preInfo?IMDataSourceInfo) => void
Type declaration
    function(infoIMDataSourceInfo, preInfo?IMDataSourceInfo): void

    Will call the function when the data source info changes.

    Parameters
    ParameterType
    info
    IMDataSourceInfo
    preInfo
    IMDataSourceInfo
    Returns 
    void

onDataSourceSchemaChange

optional
Interface Property
onDataSourceSchemaChange: (schemaIMDataSourceSchema, prevSchema?IMDataSourceSchema) => void
Type declaration

onDataSourceStatusChange

optional
Interface Property
onDataSourceStatusChange: (statusDataSourceStatus, preStatus?DataSourceStatus) => void
Type declaration

onQueryRequired

optional
Interface Property
onQueryRequired: (queryRequiredInfoQueryRequiredInfo, preQueryRequiredInfo?QueryRequiredInfo) => void
Type declaration
    function(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

onSelectionChange

optional
Interface Property
onSelectionChange: (selectionImmutableArray<string>, preSelection?ImmutableArray<string>) => void
Type declaration
    function(selectionImmutableArray<string>, preSelection?ImmutableArray<string>): void

    Will call the function when the selected records change.

    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
    selection
    ImmutableArray<string>
    preSelection
    ImmutableArray<string>
    Returns 
    void

query

optional
Interface Property
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
Interface Property
queryCount: boolean

Whether query record count when query data records.

useDataSource

optional
Interface Property
useDataSource: IMUseDataSource

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

  • If the used data source is configured in settings and is saved in widget json, please use useDataSource .
  • If the used data source is added in runtime and is not saved in widget json, please use dataSource .
  • If pass in both useDataSource and dataSource , will use dataSource .

widgetId

optional
Interface Property
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 + ??? .

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