Interface
MapServiceDataSource is created from map service or webmap/webscene.
Properties
| Property | Type | Notes |
|---|---|---|
belongToDataSourceinherited | DataSource | The data source which this data source derives from. |
countinherited | number | The total records count depends on the current query |
dataSourceManagerinherited | DataSourceManager | The data source manager, which is used to manage the data source, including create/get/destroy the data source instance. |
dataViewIdinherited | string | The data view ID configured in JSON. |
idinherited | string | The data source ID. |
isDataViewinherited | 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. |
isLocalinherited | boolean | True means the data source is a local data source. |
layer | MapImageLayer | TileLayer | When add a map service directly, there is no layer instance created.
When add a webmap that contains map service, the map service will be created as |
localIdinherited | string | The local ID of the data source. |
orderinherited | number | Order in the parent data source. |
parentDataSourceinherited | DataSource & SetDataSourceMixin | The parent data source of this data source, mull means it's a root data source. |
type | MapService | The type of the data source. |
Methods
| Method | Returns | Notes |
|---|---|---|
addSourceVersion()inherited | void | When current data source is created from an array of records, it will be saved in |
addVersion()inherited | void | Update data source version. |
areChildDataSourcesCreated()inherited | 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 ( |
buildRecord(data)inherited | DataRecord | Builds a data record only -- does not add the record into data source. |
changeGDBVersion(gdbVersion)inherited | void | Change the GDB version for all layers in the service. |
changeTimeExtent(time, widgetId) | void | Change the time extent for all layers in the service. |
childDataSourcesReady()inherited | 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 ( |
clearRecords()inherited | 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. |
clearSourceRecords()inherited | void | Clear both sourceRecords and loaded records. Both source version and version in data source info will be updated. |
createDataSourceById(dataSourceId)inherited | Promise<DataSource> | Create a child or a descendant data source by id.
Data source has this method only if it is data source set ( |
createJSAPILayerByDataSource(dataSource?, useDataSourceQueryParams?, throwError?)inherited | Promise<Layer | ArcGISSubLayer> | Default |
destroy()inherited | void | Destroy the data source. |
fetchSchema()inherited | Promise<IMDataSourceSchema> | Fetch the data schema from an actual data source. If it's a statistic data source, the schema will not be fetched. |
getAllChildDataSources()inherited | DataSource[] | Return all child data sources of a parent data source, includes the grandchildren |
getAllDerivedDataSources()inherited | DataSource[] | Return the derived data views and local data sources. |
getChildDataSource(jimuChildId)inherited | DataSource | Get child data source by |
getChildDataSourceIds()inherited | string[] | Get child data source IDs, the child data sources may not be created by the time. |
getChildDataSources()inherited | DataSource[] | Return child data sources of a parent data source. |
getCountStatus()inherited | DataSourceStatus | Return data source count status. |
getDataSourceJson()inherited | IMDataSourceJson | The data source JSON object in app config. |
getDataView(dataViewId)inherited | DataSource | Get data view by data view ID. |
getDataViewConfig()inherited | IMDataViewJson | Return the config of the current data source. |
getDataViews()inherited | DataSource[] | Return all data views created from a main data source. |
getGDBVersion()inherited | string | Get the service GDB version. |
getIdField()inherited | string | Return the data source ID field. |
getInfo()inherited | IMDataSourceInfo | Return the data source info in redux store. |
getLabel()inherited | string | Return data source label. |
getListenSelection()inherited | boolean | Return whether listen selection. |
getLocalDataSource(localId)inherited | DataSource | Get local data source by local ID. |
getLocalDataSources()inherited | DataSource[] | Return all local data sources created from a main data source or data view. |
getMainDataSource()inherited | DataSource | Return the main data source. |
getRecordById(id)inherited | DataRecord | Get record by ID |
getRecords()inherited | DataRecord[] | Get records |
getRecordsWithSelection()inherited | 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. |
getRootDataSource()inherited | DataSource | Return the root data source. |
getSchema()inherited | 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. |
getSelectedRecordIds()inherited | string[] | Get selected record IDs |
getSelectedRecordIndexes()inherited | number[] | Get selected record indexes |
getSelectedRecords()inherited | DataRecord[] | Get selected records |
getSelectionDataView()inherited | DataSource | Get selection data view |
getSourceRecords()inherited | DataRecord[] | Return the source records |
getSourceVersion()inherited | number | When current data source is created from an array of records, it will be saved in |
getStatus()inherited | DataSourceStatus | Return data source status. |
getTimeExtent() | TimeExtent | Get the time extent. |
getVersion()inherited | number | Return data source version. |
isDataSourceSet()inherited | thisisDataSource & SetDataSourceMixin | Whether a data source contains child data sources.
A set data source won't create all its child data sources when |
isInAppConfig()inherited | boolean | Return whether the data source is added in builder and is saved in app config. |
isSelectionView()inherited | boolean | Determine whether the data source is a selection view. |
ready()inherited | 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 |
selectRecordById(id, record?)inherited | 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. |
selectRecords(options)inherited | Promise<Pick<QueryResult, "records">> | Select records. |
selectRecordsByIds(ids, records?)inherited | 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. |
setCountStatus(status)inherited | void | Update data source count status. |
setDataSourceJson(dsJson)inherited | void | Update data source JSON in data source instance |
setListenSelection(listen)inherited | 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. |
setRecords(records)inherited | void | Update the records in the data source object only, does not update the source data. |
setSourceRecords(records)inherited | void | When current data source is created from an array of records, will save it in |
setStatus(status)inherited | void | Update data source status. |
updateSelectionInfo(options, triggerDataSource, forceCheck?)inherited | void | Update selected records in data source info if the current data source listens selection change (see |
addSourceVersion
addSourceVersion(): voidWhen 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
voidaddVersion
addVersion(): voidUpdate data source version.
Returns
voidareChildDataSourcesCreated
areChildDataSourcesCreated(): booleanReturn 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
booleanbuildRecord
buildRecord(data: any): DataRecordBuilds a data record only -- does not add the record into data source.
Parameters
| Parameter | Type |
|---|---|
data | any |
Returns
DataRecordchangeGDBVersion
changeGDBVersion(gdbVersion: string): voidChange the GDB version for all layers in the service.
Parameters
| Parameter | Type |
|---|---|
gdb | string |
Returns
voidchangeTimeExtent
Interface MethodchangeTimeExtent(time: TimeExtent, widgetId: string): voidChange the time extent for all layers in the service.
Parameters
| Parameter | Type |
|---|---|
time | TimeExtent |
widget | string |
Returns
voidchildDataSourcesReady
childDataSourcesReady(): 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
clearRecords(): voidThis 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
voidclearSourceRecords
clearSourceRecords(): voidClear both sourceRecords and loaded records. Both source version and version in data source info will be updated.
Returns
voidcreateDataSourceById
createDataSourceById(dataSourceId: string): 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
| Parameter | Type |
|---|---|
data | string |
Returns
Promise<DataSource>createJSAPILayerByDataSource
createJSAPILayerByDataSource(dataSource?: DataSource, useDataSourceQueryParams?: boolean, throwError?: boolean): Promise<Layer | ArcGISSubLayer>Default dataSource is the current data source.
Default useDataSourceQueryParams is true, that is to say apply the data source's query params to the created ArcGIS Maps SDK for JavaScript layer by default.
Default throwError is false, that is to say the method won't throw error and will return undefined if the creation fail.
Parameters
| Parameter | Type |
|---|---|
data | DataSource |
use | boolean |
throw | boolean |
Returns
Promise<Layer | ArcGISSubLayer>fetchSchema
fetchSchema(): 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
getAllChildDataSources(): DataSource[]Return all child data sources of a parent data source, includes the grandchildren
Returns
DataSource[]getAllDerivedDataSources
getAllDerivedDataSources(): DataSource[]Return the derived data views and local data sources.
Returns
DataSource[]getChildDataSource
getChildDataSource(jimuChildId: string): DataSourceGet child data source by jimuChildId . You can get jimuChildId by getJimuChildId() .
Parameters
| Parameter | Type |
|---|---|
jimu | string |
Returns
DataSourcegetChildDataSourceIds
getChildDataSourceIds(): string[]Get child data source IDs, the child data sources may not be created by the time.
Returns
string[]getChildDataSources
getChildDataSources(): DataSource[]Return child data sources of a parent data source.
Returns
DataSource[]getCountStatus
getCountStatus(): DataSourceStatusReturn data source count status.
Returns
DataSourceStatusgetDataSourceJson
getDataSourceJson(): IMDataSourceJsonThe data source JSON object in app config.
Returns
IMDataSourceJsongetDataView
getDataView(dataViewId: string): DataSourceGet data view by data view ID.
Parameters
| Parameter | Type |
|---|---|
data | string |
Returns
DataSourcegetDataViewConfig
getDataViewConfig(): IMDataViewJsonReturn the config of the current data source.
Returns
IMDataViewJsongetDataViews
getDataViews(): DataSource[]Return all data views created from a main data source.
Returns
DataSource[]getGDBVersion
getGDBVersion(): stringGet the service GDB version.
Returns
stringgetIdField
getIdField(): stringReturn the data source ID field.
Returns
stringgetInfo
getInfo(): IMDataSourceInfoReturn the data source info in redux store.
Returns
IMDataSourceInfogetListenSelection
getListenSelection(): booleanReturn whether listen selection.
Returns
booleangetLocalDataSource
getLocalDataSource(localId: string): DataSourceGet local data source by local ID.
Parameters
| Parameter | Type |
|---|---|
local | string |
Returns
DataSourcegetLocalDataSources
getLocalDataSources(): DataSource[]Return all local data sources created from a main data source or data view.
Returns
DataSource[]getMainDataSource
getMainDataSource(): DataSourceReturn the main data source.
Returns
DataSourcegetRecordById
getRecordById(id: string): DataRecordGet record by ID
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
DataRecordgetRecords
getRecords(): DataRecord[]Get records
Returns
DataRecord[]getRecordsWithSelection
getRecordsWithSelection(): 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
getRootDataSource(): DataSourceReturn the root data source.
Returns
DataSourcegetSchema
getSchema(): IMDataSourceSchemaThe 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
IMDataSourceSchemagetSelectedRecordIds
getSelectedRecordIds(): string[]Get selected record IDs
Returns
string[]getSelectedRecordIndexes
getSelectedRecordIndexes(): number[]Get selected record indexes
Returns
number[]getSelectedRecords
getSelectedRecords(): DataRecord[]Get selected records
Returns
DataRecord[]getSelectionDataView
getSelectionDataView(): DataSourceGet selection data view
Returns
DataSourcegetSourceRecords
getSourceRecords(): DataRecord[]Return the source records
Returns
DataRecord[]getSourceVersion
getSourceVersion(): numberWhen current data source is created from an array of records, it will be saved in sourceRecords .
Return the version of sourceRecords .
Returns
numbergetStatus
getStatus(): DataSourceStatusReturn data source status.
Returns
DataSourceStatusgetVersion
getVersion(): numberReturn data source version.
Returns
numberisDataSourceSet
isDataSourceSet(): thisisDataSource & SetDataSourceMixinWhether 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 .
Returns
thisisDataSource & SetDataSourceMixinisInAppConfig
isInAppConfig(): booleanReturn whether the data source is added in builder and is saved in app config.
Returns
booleanisSelectionView
isSelectionView(): booleanDetermine whether the data source is a selection view.
Returns
booleanready
ready(): 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
selectRecordById(id: string, record?: DataRecord): voidSelect 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
| Parameter | Type | Notes |
|---|---|---|
id | string | The ID to be selected. The selection will be cleared if the ID is null. |
record | DataRecord |
Returns
voidselectRecords
selectRecords(options: SelectOptions): Promise<Pick<QueryResult, "records">>Select records.
Parameters
| Parameter | Type |
|---|---|
options | SelectOptions |
Returns
Promise<Pick<QueryResult, "records">>selectRecordsByIds
selectRecordsByIds(ids: string[], records?: DataRecord[]): voidSelect 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
| Parameter | Type | Notes |
|---|---|---|
ids | string[] | The IDs to be selected. The selection will be cleared if the IDs are null. |
records | DataRecord[] |
Returns
voidsetCountStatus
setCountStatus(status: DataSourceStatus): voidUpdate data source count status.
Parameters
| Parameter | Type |
|---|---|
status | DataSourceStatus |
Returns
voidsetDataSourceJson
setDataSourceJson(dsJson: IMDataSourceJson): voidUpdate data source JSON in data source instance
Parameters
| Parameter | Type |
|---|---|
ds | IMDataSourceJson |
Returns
voidsetListenSelection
setListenSelection(listen: boolean): voidWhether 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
| Parameter | Type |
|---|---|
listen | boolean |
Returns
voidsetRecords
setRecords(records: DataRecord[]): voidUpdate the records in the data source object only, does not update the source data.
Parameters
| Parameter | Type |
|---|---|
records | DataRecord[] |
Returns
voidsetSourceRecords
setSourceRecords(records: DataRecord[]): voidWhen 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
| Parameter | Type |
|---|---|
records | DataRecord[] |
Returns
voidsetStatus
setStatus(status: DataSourceStatus): voidUpdate data source status.
Parameters
| Parameter | Type |
|---|---|
status | DataSourceStatus |
Returns
voidupdateSelectionInfo
updateSelectionInfo(options: SelectOptions, triggerDataSource: DataSource, forceCheck?: boolean): voidUpdate 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 current 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
| Parameter | Type |
|---|---|
options | SelectOptions |
trigger | DataSource |
force | boolean |
Returns
void