DataSource

Interface

The interface for all data sources.

Conceptually, we have four types of data sources but all of them are created as data source object:

  • Main data source: the data source user added in data panel.
  • Data view: the data view user created in data panel.
  • Local data source: when multiple widgets connnect to a main data source or a data view, they'll share the same data records. If you need to use a local data copy, you can create a local data source from a main data source by using DataSourceManager.getInstance().createLocalDataSource() .
  • Local data view: a local data source created from a data view.

Data view, local data source or local data view derived from the same main data source will share the same schema, same selection records, but may have different data records. The schema is in main data source only.

To share the selection between data source and view, we create a selection data view when creating the data source. The selection data source view ID is: ${dataSourceId}-selection . When selecting records, the selected records are copied to the selection data view.

Properties

PropertyTypeNotes
() => void
() => void
() => boolean

The data source which this data source derives from.

(dataany) => DataRecord
() => Promise<DataSource[]>
() => void
() => void
number

The total records count depends on the current query

(dataSourceIdstring) => Promise<DataSource>

The data source manager, which is used to manage the data source, including create/get/destroy the data source instance.

string

The data view ID configured in JSON.

() => void
() => Promise<IMDataSourceSchema>
() => DataSource[]
() => DataSource[]
(jimuChildIdstring) => DataSource
() => DataSource[]
() => IMDataSourceJson
(dataViewIdstring) => DataSource
() => IMDataViewJson
() => DataSource[]
() => string
() => IMDataSourceInfo
() => string
() => boolean
(localIdstring) => DataSource
() => DataSource[]
(indexnumber) => DataRecord
(idstring) => DataRecord
() => DataRecord[]
() => DataRecord[]
() => string[]
() => number[]
() => DataRecord[]
() => DataRecord[]
() => number
() => number
string

The data source ID.

boolean

Whether a data source contains child data sources. A set data source won't create all its child data sources when ready is resolved. To make sure all child data sources are created, please use childDataSourcesReady .

boolean

True means the data source is a data view. For local data source, this is false even the local data source is created from a data view.

() => boolean
boolean

True means the data source is a local data source.

string

The local ID of the data source.

number

Order in the parent data source.

The parent data source of this data source, mull means it's a root data source.

() => Promise<any>
(idstring, record?DataRecord) => void
(optionsSelectOptions) => Promise<Pick<QueryResult"records">>
(idsstring[], records?DataRecord[]) => void
(statusDataSourceStatus) => void
(dsJsonIMDataSourceJson) => void
(listenboolean) => void
(recordsDataRecord[]) => void
(recordsDataRecord[]) => void
(statusDataSourceStatus) => void
string

The type of the data source.

(optionsSelectOptions, triggerDataSourceDataSource, forceCheck?boolean) => void

addSourceVersion

Interface Property
addSourceVersion: () => void
Type declaration
    function(): void

    When current data source is created from an array of records, it will be saved in sourceRecords . Add the version of sourceRecords .setSourceRecords will add the version by default.

    Returns 
    void

addVersion

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

    Update data source version.

    Returns 
    void

areChildDataSourcesCreated

optional
Interface Property
areChildDataSourcesCreated: () => boolean
Type declaration
    function(): boolean

    Return whether all child data sources (including descendant data sources) are created. Data source has this method only if it is data source set ( dataSource.isDataSourceSet is true).

    Returns 
    boolean

belongToDataSource

optional
Interface Property
belongToDataSource: DataSource

The data source which this data source derives from.

buildRecord

Interface Property
buildRecord: (dataany) => DataRecord
Type declaration
    function(dataany): DataRecord

    Builds a data record only -- does not add the record into data source.

    Parameters
    ParameterType
    data
    any
    Returns 
    DataRecord

childDataSourcesReady

optional
Interface Property
childDataSourcesReady: () => Promise<DataSource[]>
Type declaration
    function(): Promise<DataSource[]>

    All child data sources (including descendant data sources) are ready for use. Data source has this method only if it is data source set ( dataSource.isDataSourceSet is true).

    Returns 
    Promise<DataSource[]>

clearRecords

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

    This function will clear the loaded records and won't clear the sourceRecords. Once the loaded records are cleared, the version in the data source info will be updated.

    Returns 
    void

clearSourceRecords

Interface Property
clearSourceRecords: () => void
Type declaration
    function(): void

    Clear both sourceRecords and loaded records. Both source version and version in data source info will be updated.

    Returns 
    void

count

optional
Interface Property
count: number

The total records count depends on the current query

createDataSourceById

optional
Interface Property
createDataSourceById: (dataSourceIdstring) => Promise<DataSource>
Type declaration
    function(dataSourceIdstring): Promise<DataSource>

    Create a child or a descendant data source by id. Data source has this method only if it is data source set ( dataSource.isDataSourceSet is true).

    Please note will only create the specific data source, won't create descendant data sources of it.

    Parameters
    ParameterType
    dataSourceId
    string
    Returns 
    Promise<DataSource>

dataSourceManager

Interface Property
dataSourceManager: DataSourceManager

The data source manager, which is used to manage the data source, including create/get/destroy the data source instance.

dataViewId

optional
Interface Property
dataViewId: string

The data view ID configured in JSON.

destroy

Interface Property
destroy: () => void
Type declaration
    function(): void

    Destroy the data source.

    Returns 
    void

fetchSchema

Interface Property
fetchSchema: () => Promise<IMDataSourceSchema>
Type declaration
    function(): Promise<IMDataSourceSchema>

    Fetch the data schema from an actual data source. If it's a statistic data source, the schema will not be fetched.

    Returns 
    Promise<IMDataSourceSchema>

getAllChildDataSources

optional
Interface Property
getAllChildDataSources: () => DataSource[]
Type declaration
    function(): DataSource[]

    Return all child data sources of a parent data source, includes the grandchildren

    Returns 
    DataSource[]

getAllDerivedDataSources

Interface Property
getAllDerivedDataSources: () => DataSource[]
Type declaration

getChildDataSource

optional
Interface Property
getChildDataSource: (jimuChildIdstring) => DataSource
Type declaration
    function(jimuChildIdstring): DataSource

    Get child data source by jimuChildId . You can get jimuChildId by getJimuChildId() .

    Parameters
    ParameterType
    jimuChildId
    string
    Returns 
    DataSource

getChildDataSources

optional
Interface Property
getChildDataSources: () => DataSource[]
Type declaration

getCountStatus

Interface Property
getCountStatus: () => DataSourceStatus
Type declaration

getDataSourceJson

Interface Property
getDataSourceJson: () => IMDataSourceJson
Type declaration
    function(): IMDataSourceJson

    The data source JSON object in app config.

    Returns 
    IMDataSourceJson

getDataView

Interface Property
getDataView: (dataViewIdstring) => DataSource
Type declaration
    function(dataViewIdstring): DataSource

    Get data view by data view ID.

    Parameters
    ParameterType
    dataViewId
    string
    Returns 
    DataSource

getDataViewConfig

Interface Property
getDataViewConfig: () => IMDataViewJson
Type declaration
    function(): IMDataViewJson

    Return the config of the current data source.

    Returns 
    IMDataViewJson

getDataViews

Interface Property
getDataViews: () => DataSource[]
Type declaration

getIdField

Interface Property
getIdField: () => string
Type declaration
    function(): string

    Return the data source ID field.

    Returns 
    string

getInfo

Interface Property
getInfo: () => IMDataSourceInfo
Type declaration
    function(): IMDataSourceInfo

    Return the data source info in redux store.

    Returns 
    IMDataSourceInfo

getLabel

Interface Property
getLabel: () => string
Type declaration
    function(): string

    Return data source label.

    Returns 
    string

getListenSelection

Interface Property
getListenSelection: () => boolean
Type declaration
    function(): boolean

    Return whether listen selection.

    Returns 
    boolean

getLocalDataSource

Interface Property
getLocalDataSource: (localIdstring) => DataSource
Type declaration
    function(localIdstring): DataSource

    Get local data source by local ID.

    Parameters
    ParameterType
    localId
    string
    Returns 
    DataSource

getLocalDataSources

Interface Property
getLocalDataSources: () => DataSource[]
Type declaration
    function(): DataSource[]

    Return all local data sources created from a main data source or data view.

    Returns 
    DataSource[]

getMainDataSource

Interface Property
getMainDataSource: () => DataSource
Type declaration

getRecord

Interface Property
getRecord: (indexnumber) => DataRecord
Type declaration
    function(indexnumber): DataRecord

    Get record by index

    Parameters
    ParameterType
    index
    number
    Returns 
    DataRecord

getRecordById

Interface Property
getRecordById: (idstring) => DataRecord
Type declaration

getRecords

Interface Property
getRecords: () => DataRecord[]
Type declaration

getRecordsWithSelection

Interface Property
getRecordsWithSelection: () => DataRecord[]
Type declaration
    function(): DataRecord[]

    If selected records are not loaded in the current data source, they will be concatenated to the end of records array. For example, record 1 is selected in data view 1 and it is not loaded in data view 2 (record 1 actually matches query params of data view 2), dataView2.getRecordsWithSelection() will return all loaded records in data view 2 and record 1.

    Returns 
    DataRecord[]

getRootDataSource

Interface Property
getRootDataSource: () => DataSource
Type declaration

getSchema

Interface Property
getSchema: () => IMDataSourceSchema
Type declaration
    function(): IMDataSourceSchema

    The schema returned here is the merged result of the configured schema and the fetched schema. The configured schema is the user's changes, such as a new data source name. The fetched schema is the original schema from AGOL/portal item or a remote database, such as the service name, the fields and the filters.

    Returns 
    IMDataSourceSchema

getSelectedRecordIds

Interface Property
getSelectedRecordIds: () => string[]
Type declaration
    function(): string[]

    Get selected record IDs

    Returns 
    string[]

getSelectedRecordIndexes

Interface Property
getSelectedRecordIndexes: () => number[]
Type declaration
    function(): number[]

    Get selected record indexes

    Returns 
    number[]

getSelectedRecords

Interface Property
getSelectedRecords: () => DataRecord[]
Type declaration

getSourceRecords

Interface Property
getSourceRecords: () => DataRecord[]
Type declaration

getSourceVersion

Interface Property
getSourceVersion: () => number
Type declaration
    function(): number

    When current data source is created from an array of records, it will be saved in sourceRecords . Return the version of sourceRecords .

    Returns 
    number

getStatus

Interface Property
getStatus: () => DataSourceStatus
Type declaration

getVersion

Interface Property
getVersion: () => number
Type declaration
    function(): number

    Return data source version.

    Returns 
    number

id

Interface Property
id: string

The data source ID.

isDataSourceSet

Interface Property
isDataSourceSet: boolean

Whether a data source contains child data sources. A set data source won't create all its child data sources when ready is resolved. To make sure all child data sources are created, please use childDataSourcesReady .

isDataView

Interface Property
isDataView: boolean

True means the data source is a data view. For local data source, this is false even the local data source is created from a data view.

isInAppConfig

Interface Property
isInAppConfig: () => boolean
Type declaration
    function(): boolean

    Return whether the data source is added in builder and is saved in app config.

    Returns 
    boolean

isLocal

Interface Property
isLocal: boolean

True means the data source is a local data source.

localId

optional
Interface Property
localId: string

The local ID of the data source.

order

optional
Interface Property
order: number

Order in the parent data source.

parentDataSource

Interface Property
parentDataSource: DataSource

The parent data source of this data source, mull means it's a root data source.

ready

Interface Property
ready: () => Promise<any>
Type declaration
    function(): Promise<any>

    Ready is resolved means the data source instance is ready for use. Please note that can not make sure all child data sources are created if a set data source is ready. To make sure all child data sources are created, please use childDataSourcesReady .

    Returns 
    Promise<any>

selectRecordById

Interface Property
selectRecordById: (idstring, record?DataRecord) => void
Type declaration
    function(idstring, record?DataRecord): void

    Select a record by ID. When select record by ID, we can pass in the record. So when the selected record is not loaded, we can add it in.

    Parameters
    ParameterTypeNotes
    id
    string

    The ID to be selected. The selection will be cleared if the ID is null.

    record
    DataRecord
    Returns 
    void

selectRecords

Interface Property
selectRecords: (optionsSelectOptions) => Promise<Pick<QueryResult"records">>
Type declaration

selectRecordsByIds

Interface Property
selectRecordsByIds: (idsstring[], records?DataRecord[]) => void
Type declaration
    function(idsstring[], records?DataRecord[]): void

    Select records by IDs. When select records by IDs, we can pass in the records. So when the selected records are not loaded, we can add them in.

    Parameters
    ParameterTypeNotes
    ids
    string[]

    The IDs to be selected. The selection will be cleared if the IDs are null.

    records
    DataRecord[]
    Returns 
    void

setCountStatus

optional
Interface Property
setCountStatus: (statusDataSourceStatus) => void
Type declaration

setDataSourceJson

Interface Property
setDataSourceJson: (dsJsonIMDataSourceJson) => void
Type declaration
    function(dsJsonIMDataSourceJson): void

    Update data source JSON in data source instance

    Parameters
    ParameterType
    dsJson
    IMDataSourceJson
    Returns 
    void

setListenSelection

Interface Property
setListenSelection: (listenboolean) => void
Type declaration
    function(listenboolean): void

    Whether listen selected records from other data sources which are derived from the same main data source. If true, will update selected record IDs of current data source info when selecting records via other derived data sources. Will also update selected record IDs when selecting records via current data source itself. If false, won't change selected record IDs when selecting records via other derived data sources. Will update selected record IDs only when selecting records via current data source itself.

    Main data source and its data views will listen selected records by default, local data source does not listen selected records by default.

    Parameters
    ParameterType
    listen
    boolean
    Returns 
    void

setRecords

Interface Property
setRecords: (recordsDataRecord[]) => void
Type declaration
    function(recordsDataRecord[]): void

    Update the records in the data source object only, does not update the source data.

    Parameters
    ParameterType
    records
    DataRecord[]
    Returns 
    void

setSourceRecords

Interface Property
setSourceRecords: (recordsDataRecord[]) => void
Type declaration
    function(recordsDataRecord[]): void

    When current data source is created from an array of records, will save it in sourceRecords . These two methods are used to update or get the source data.

    Parameters
    ParameterType
    records
    DataRecord[]
    Returns 
    void

setStatus

optional
Interface Property
setStatus: (statusDataSourceStatus) => void
Type declaration

type

Interface Property
type: string

The type of the data source.

updateSelectionInfo

Interface Property
updateSelectionInfo: (optionsSelectOptions, triggerDataSourceDataSource, forceCheck?boolean) => void
Type declaration
    function(optionsSelectOptions, triggerDataSourceDataSource, forceCheck?boolean): void

    Update selected records in data source info if the current data source listens selection change (see setListenSelection ) or the current data source is the trigger data source (that is to say, select via it).

    Before update info, will check whether these selected records match filters of the current data source firstly, and then only set the matched selected records to info. Will skip the check in some cases to improve performance if the forceCheck is not passed in or is false. For example, if the curren data source is main data source (we suppose that main data source contains all records, no need to check). But if the forceCheck is true, won't skip the check.

    Parameters
    ParameterType
    options
    SelectOptions
    triggerDataSource
    DataSource
    forceCheck
    boolean
    Returns 
    void

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