Editor window doesn't come up

2744
1
02-09-2015 01:22 PM
EdwardSohn2
New Contributor III

Following is editor window initialization: the editor window does not come up.  Rather the regular infowindow for the map comes up.

The code runs within the context of ArcGIS Online map template.  So the map variable is being passed in.

The code is virtually unchanged from a sample, where the only difference is the map variable is instantiated inside the function (commented out).  Is there some setting inside the map object that needs to be set to enable editor window vs infowindow from appearing?

require([

                      "esri/config",

                      "esri/map",

                      "esri/SnappingManager",

                      "esri/dijit/editing/Editor",

                      "esri/layers/FeatureLayer",

                      "esri/tasks/GeometryService",

                      "esri/toolbars/draw",

                      "dojo/keys",

                      "dojo/parser",

                      "dojo/_base/array",

                      "dojo/i18n!esri/nls/jsapi",

                      "dijit/layout/BorderContainer",

                      "dijit/layout/ContentPane",

                      "dojo/domReady!"

                    ], function (

                      esriConfig, Map, SnappingManager, Editor, FeatureLayer, GeometryService,

                      Draw, keys, parser, arrayUtils, i18n

                      ) {

                        parser.parse();

                        //This sample requires a proxy page to handle communications with the ArcGIS Server services. You will need to

                        //replace the url below with the location of a proxy on your machine. See the 'Using the proxy page' help topic

                        //for details on setting up a proxy page.

                        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("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

           /* map = new Map("map", {

                basemap: "topo",

                center: [-77.036, 38.891],

                zoom: 16

            }); */

                        map.on("layers-add-result", initEditing);

                        var operationsPointLayer = new FeatureLayer("https://.../FeatureServer/0", {

                            mode: FeatureLayer.MODE_ONDEMAND,

                            outFields: ["*"]

                        });

                        map.addLayers([

                          operationsPointLayer

                        ]);

                        map.infoWindow.resize(400, 300);

                        function initEditing(event) {

                            var featureLayerInfos = arrayUtils.map([{ "layer": operationsPointLayer }], function (layer) {

                                return {

                                    "featureLayer": layer.layer

                                };

                            });

                            var settings = {

                                map: map,

                                layerInfos: featureLayerInfos

                            };

                            var params = {

                                settings: settings

                            };

                            var editorWidget = new Editor(params, 'editorDiv');

                            editorWidget.startup();

                            //snapping defaults to Cmd key in Mac & Ctrl in PC.

                            //specify "snapKey" option only if you want a different key combination for snapping

                            map.enableSnapping();

                            deferred.resolve(true);

                        }

                    });

0 Kudos
1 Reply
ChrisSergent
Regular Contributor III

Right after your initEditing, my code differs and is written like this:

var featureLayerInfos = arrayUtils.map(event.layers, function (layer) {

                                 return {

                                     "featureLayer": layer.layer

                                 };

                             });

And right below editorWidgetStartup I have something like this:

var options = { snapKey: keys.copyKey };

                             map.enableSnapping(options);

I don't know if you need deferred.resolved(true); but I don'e have it in my app.

0 Kudos