Arcgis js api featureLayer Editor widget does not display new feature options

Original link: https://www.mqllin.cn/archives/199.html

Arcgis js api featureLayer Editor widget does not display new feature options

Arcgis js sdkFeatureLayer Editor widget don’t have add geometry option

Encountered such a problem in the development, through the ILayerDefinition layer configuration built by myself, when using the Rest API to create a new layer from the server. The Editor weight component does not display new items. Unable to use the editor component to add features on this layer, marking will be processed. After comparing with the layer configuration created by Arcgis Portal, I found that I did not configure the `templates` attribute. Just add this property configuration.

If you need to preset the drawing style, you can configure it through `drawingInfo`.

“`

templates = [

{

name: ‘New Feature’,

description: “,

prototype: {

attributes: {}

}

}

] as ITemplate[];

“`

Here are two basic style configuration references for line and surface:

“`

if (type === ‘esriGeometryPolyline’) {

this.drawingInfo = {

‘renderer’: {

‘type’: ‘simple’,

‘symbol’: {

‘color’: [128, 0, 128, 255],

‘width’: 2,

‘type’: ‘esriSLS’,

‘style’: ‘esriSLSSolid’

}

}

};

}

if (type === ‘esriGeometryPolygon’) {

this.drawingInfo = {

‘renderer’: {

‘type’: ‘simple’,

‘symbol’: {

‘color’: [128, 0, 128, 255],

‘type’: ‘esriSFS’,

‘style’: ‘esriSFSSolid’,

‘outline’: {

‘color’: [128, 0, 128, 255],

‘width’: 1.5,

‘type’: ‘esriSLS’,

‘style’: ‘esriSLSSolid’

}

}

}

};

}

“`

This article is transferred from: https://www.mqllin.cn/archives/199.html
This site is only for collection, and the copyright belongs to the original author.