This bundle allows to register ArcGIS Feature or MapServer layers as stores for multiple purposes (for example search and selection). The bundle provides a common configuration interface for the stores and contains a component factory to create multiple instances of stores.
See the API for interface declarations.
The following code sample shows the minimal configuration of a store:
"agssearch": {
"AGSStore":[{
"id": "Airports",
"url": "https://myserver/arcgis/rest/services/Airports/MapServer/0"
}]
}
To register stores automatically, enable the AutoStoreRegistration
component as in the following code sample:
"agssearch": {
"AutoStoreRegistration": {
"componentEnabled": true
}
},
To add default popups to a store, set popupEnabled
to true
and add the popups-default bundle to your app.
"agssearch": {
"AGSStore":[{
"id": "Airports",
"url": "https://myserver/arcgis/rest/services/Airports/MapServer/0",
"popupEnabled": true
}]
}
To add an individual popup to a store, configure a popupTemplate
as in the following sample:
"agssearch": {
"AGSStore":[{
"id": "Airports",
"url": "https://myserver/arcgis/rest/services/Airports/MapServer/0",
"popupTemplate": {
"title": "{name}",
"content": [
{
"type": "fields",
"fieldInfos": [
{
"fieldName": "myfield",
"label": "My field"
}
]
}
]
}
}]
}
For more information about configuring individual popups, see Individual popups in the product documentation.
To add a customized popup to a store, set the popupType
and/or customActions
as in the following code sample:
"agssearch": {
"AGSStore":[{
"id": "Airports",
"url": "https://myserver/arcgis/rest/services/Airports/MapServer/0",
"popupTemplate": {
"popupType": "mywidget",
"customActions": [
"fullScreenWindowAction"
]
}
}]
}
For more information about adding custom popup types and actions, see the popups bundle documentation.
Use the service name agssearch.AGSStoreFactory
to obtain a factory reference for your component:
// manifest.json
// ...
"components": [
{
"name": "MyExampleComponent",
"references": [
{
"name": "_storeFactory",
"providing": "agssearch.AGSStoreFactory"
}
]
}
]
// ...
You can then use the createStore method to construct a new instance:
class MyExampleComponent {
async exampleMethod() {
const store = await this._storeFactory.createStore({
id: "my-new-store",
layerId: "a-valid-layer-id"
// or url: "https://example.com/some/FeatureServer"
});
}
}
string
.AutoStoreRegistration
respects the visible state (on/off) of a layer.
It does not respect if the layer can be seen in the map (for example depending on the extent or map scale).AutoStoreRegistration
.The following code sample shows the configurable properties in a sample store:
"agssearch": {
"AGSStore":[ {
"id": "Airports",
"url": "https://myserver/arcgis/rest/services/myservice/MapServer/0",
"apiKey": "__KEY__",
// use instead of url
"layerId": "myservice/0",
"title": "Airports",
"description": "Find all international airports",
"useIn":[ "search", "selection"],
"legacyImplementation": false,
"searchAttribute": "icao_name",
"searchLabel": "${icao_name} (${city})",
"searchPriority": 1,
"filterOptions": {
"suggestContains": true,
"metadata": {
"fields":[ {
"name": "OBJECTID",
"title": "ID"
},
{
"name": "icao_name",
"title": "NAME"
}]
}
},
"popupEnabled": true,
"popupTemplate": {
"title": "",
"content": []
}
}]
}
Property | Type | Description |
---|---|---|
id |
String | ID of the store. Must be unique within an app. |
url |
String | URL to an ArcGIS Feature Layer or MapServer Layer. |
apiKey |
String | API key to use when accessing the service. Can be used when url has been specified. |
layerId |
String | ID of a service/layer used in the app. Use it instead of url . Use layerid/sublayer for MapServer layers or layerid for FeatureServer layers. |
useIn |
Array | Defines, if the store is used in search and/or selection. |
legacyImplementation |
Boolean | Switches back to the deprecated MapServerLayerStore class. Some legacy options only have an effect when this is true. Defaults to false . |
searchAttribute |
String | Name of the attribute the search is performed on. Only one attribute can be used. |
searchLabel |
String | Attribute name(s) displayed in the list of search results. To use multiple fields, use syntax "${field1} ${field2}" . If only one field should be shown, the fieldname can be configured (for example "field1" ). If this parameter is not defined, the field defined in searchAttribute is used. |
searchPriority |
Number | Defines The search priority of the store. A lower value indicates a higher priority. The default priority is 50. The value is evaluated by the search-ui bundle. |
filterOptions |
Object | |
> suggestContains |
Boolean | To enable a "contains search" instead of a "starts with search", set to true . |
> metadata |
String | Used for ArcGIS Server features, for example find layer fields. |
The following properties are supported if legacyImplementation
is set to true
:
Property | Type | Description |
---|---|---|
fetchIdProperty |
Boolean | Defines, if the idProperty of the store is resolved automatically. |
idProperty |
String | ID field (only used if fetchIdProperty is set to false ). |
disableIdQueries |
Boolean | Defines, if requests to ArcGIS Server contain the parameter returnIdsOnly=true . If set to true , the parameter is not used. |
enablePagination |
Boolean | Enables the use of pagination to browse all features in the server, not only the limit of 1000 features for example. |
enableObjectIdsQueries |
Boolean | Enables the use of the objectIds parameter in queries instead of where=OBJECTID IN (a,b,c) style queries. It is disabled by default, because services build on top of database views do not support these kind of |