AnsweredAssumed Answered

Attribute Inspector doesn't open when editing

Question asked by dunkl1lm on Sep 13, 2017
Latest reply on Sep 17, 2017 by dunkl1lm

  I am attempting to use the Editor widget from the JS API - my editor initializes and I can see all of the layers/symbols available that I want to be able to edit.  Clicking on one and drawing on the map creates a feature, but the attribute inspector never opens.  Clicking on an already created feature also does not open the attribute inspector.  Code is below.  Not all layers in my application should be editable, so I am looping through a list to add them to the editor widget.  This works fine.  The init edit function is fired when a button is clicked, which opens a panel containing the edit Div.

 

var editor;
var templatePicker;

require([
"esri/map",
"esri/tasks/GeometryService",
"esri/layers/FeatureLayer",
"esri/Color",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/dijit/editing/Editor",
"esri/dijit/editing/TemplatePicker",
"esri/config",
"dojo/i18n!esri/nls/jsapi",
"dojo/_base/array",
"dojo/parser",
"dojo/keys",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dojo/domReady!"
], function(
Map,
GeometryService,
FeatureLayer,
Color,
SimpleMarkerSymbol,
SimpleLineSymbol,
Editor,
TemplatePicker,
esriConfig,
jsapiBundle,
arrayUtils,
parser,
keys
) {


// snapping is enabled for this sample - change the tooltip to reflect this
jsapiBundle.toolbars.draw.start = jsapiBundle.toolbars.draw.start + "<br>Press <b>ALT</b> to enable snapping";

// refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/3/jshelp/ags_proxy.html
//esriConfig.defaults.io.proxyUrl = "/proxy/";

//This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications.
esriConfig.defaults.geometryService = new GeometryService(geometryService);

initEditor = function(evt) {
document.getElementById("pnlEdit").style.height = spatialEditSize;
var templateLayers = [];
var lay = [];
for (i=0;i<layers.length;i++){
if (layers[i].spatialEdit == true){
templateLayers.push(layerList[i]);
lay.push({featureLayer: layerList[i]})
}
}

templatePicker = new TemplatePicker({
featureLayers: templateLayers,
grouping: true,
rows: "auto",
columns: 3,
}, "templateDiv");
templatePicker.startup();

var settings = {
map: map,
templatePicker: templatePicker,
layerInfos: lay,
toolbarVisible: true,
createOptions: {
polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ],
polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON,
Editor.CREATE_TOOL_CIRCLE,
Editor.CREATE_TOOL_TRIANGLE,
Editor.CREATE_TOOL_RECTANGLE
]
},
toolbarOptions: {
reshapeVisible: true
}
};

var parameters = { settings: settings};
console.log(parameters);
editor = new Editor(parameters, 'editorDiv');
//define snapping options
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CROSS,
15,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255, 0, 0, 0.5]),
5
),
null
);
map.enableSnapping({
snapPointSymbol: symbol,
tolerance: 20,
snapKey: keys.ALT
});
editor.startup();
console.log(settings);
}
});

Outcomes