function addEditor(r){ var contentHolder = "<div id='editorDiv'></div><div id='tmpDiv'></div>"; $j('##editDiv').append(contentHolder); var templateLayers = dojo.map(r,function(result){ return result.layer; }); var widget = new esri.dijit.editing.TemplatePicker({ featureLayers: templateLayers, grouping: true, rows: 'auto', columns: 3 },'tmpDiv'); widget.startup(); var layers = dojo.map(r, function(result) { return {featureLayer:result.layer}; }); var settings = { map: map, templatePicker: widget,// <------- templatePicker for editor -----> geometryService: new esri.tasks.GeometryService(GEOSERVICE), layerInfos:layers, toolbarVisible: true, createOptions: { polylineDrawTools:[ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYLINE], polygonDrawTools: [ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON, esri.dijit.editing.Editor.CREATE_TOOL_CIRCLE, esri.dijit.editing.Editor.CREATE_TOOL_TRIANGLE, esri.dijit.editing.Editor.CREATE_TOOL_RECTANGLE ] }, toolbarOptions: { reshapeVisible: true } }; var params = {settings: settings}; myEditor = new esri.dijit.editing.Editor(params,'editorDiv'); myEditor.startup(); }
_createAttributeInspector: function(){ if (!this._settings.attributeInspector) { this._customAttributeInspector = false; var map = this._settings.map; map.infoWindow.setContent("<div id='content' style='width:100%'></div>"); map.infoWindow.setTitle(esri.bundle.widgets.attributeInspector.NLS_title); map.infoWindow.resize(350, 375); this._attributeInspector = new esri.dijit.AttributeInspector({ layerInfos: this._settings.layerInfos }, dojo.byId("content")); } else { this._customAttributeInspector = true; this._attributeInspector = this._settings.attributeInspector; } . . . }
var layers = dojo.map(r, function(result) { return {featureLayer:result.layer}; }); var ai = new esri.dijit.AttributeInspector({layerInfos:[layers]}, "attrInspector"); var settings = { map: map, attributeInspector: ai, templatePicker: widget, geometryService: new esri.tasks.GeometryService(GEOSERVICE), layerInfos:layers, toolbarVisible: true, createOptions: { polylineDrawTools:[ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYLINE], polygonDrawTools: [ esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON, esri.dijit.editing.Editor.CREATE_TOOL_CIRCLE, esri.dijit.editing.Editor.CREATE_TOOL_TRIANGLE, esri.dijit.editing.Editor.CREATE_TOOL_RECTANGLE ] }, toolbarOptions: { reshapeVisible: true } }; var params = {settings: settings}; myEditor = new esri.dijit.editing.Editor(params,'editorDiv'); myEditor.startup(); //aiChange is defined ouside this function aiChange = dojo.connect(ai,'onAttributeChange',attributesChanged);
Boy I was looking at the same thing. Were you ever able to find anything?
The Editor gives you access to the Edit toolbar:
Editor | API Reference | ArcGIS API for JavaScript 3.20
Just listen for the 'activate' event which give you the current graphic:
Edit | API Reference | ArcGIS API for JavaScript 3.20
You can update the desired attribute of the graphic, then refresh the AttributeInspector:
AttributeInspector | API Reference | ArcGIS API for JavaScript 3.20
Perfect. The attribute inspector was the piece of information i was looking for. It was hiding in plain sight. lol.
Question for you John: Do you have any knowledge of extending the attribute inspector?
I see that it has constants of textbox, text area and richtext and i was looking to introduce filteringselect/combobox functionality to my application. In reality, i just wanted to load in values so users wouldn't have to type in everything. It would also provide some data editing quality control.
Based on what i saw, the functionality i want seems like a stretch, but perhaps i have it wrong. I figured i would ask anyway.
When i say load in values, i mean loading in a list of value choices, not predefined/absolute values for a feature.
From AttributeInspector | API Reference | ArcGIS API for JavaScript 3.20 - "The AttributeInspector widget honors the domains and subtypes as defined by the Feature Service." This means that a dropdown list of appropriate values will be presented to the user, and this is the best way to add the functionality you need as you're ensuring only one of the correct values are used and these constraints are available throughout the system and not just your app. Additionally, if you need more control, you can specify your own dijit to handle the update for a specific field by using the 'customField' property when specifying the 'fieldInfos' of a 'layerInfo' in the AttributeInspector constructor.
This is fantastic. Thank you. Off to the races.