Select to view content in your preferred language

How do I resolve the conflict of info Windows on multiple widgets?

6324
20
Jump to solution
12-18-2014 07:52 AM
ChrisSergent
Deactivated User

I have a geocode widget and the default editor widget. They both use infoWindows. When I do a search for an address, the goecode widget's infoWindow is retained. For example if I search for an address of 100 S Main and then I click on the editor widget, instead of the editor window displaying, the address that I just search for displays. The conflict is infoWindow. What do I need to do to my code to resolve this conflict?

Here are the two blocks of code for these widgets:

Editor-

// Starts initEditing after the feature layer(s) have been added

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

                // add imagery

                var tiled = new ArgGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer");

                map.addLayer(tiled);

                // add operational layer

                var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", {

                    "opacity": 0.5

                });

                map.addLayer(operationalLayer);

                // add point feature layer for editing

                var pointFeatureLayer = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/Test/FeatureServer/0", {

                    mode: FeatureLayer.MODE_ONDEMAND,

                    outFields: ["*"]

                });

                map.addLayers([pointFeatureLayer]);

                // settings for the editor widget

                function initEditing(event) {

                    // sizes the edit window

                    map.infoWindow.resize(400, 300);

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

                        return {

                            "featureLayer": layer.layer

                        };

                    });

                    var settings = {

                        map: map,

                        layerInfos: featureLayerInfos,

                        toolbarVisible: true,

                        enableUndoRedo: true,

                        maxUndoOperations: 20

                    };

                    var params = {

                        settings: settings

                    };

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

                    editorWidget.startup();

                    var options = { snapKey: keys.copyKey };

                    map.enableSnapping(options);

                }

Geocode -

// begin geocoder

                var geocoder = new Geocoder({

                    arcgisGeocoder: false,

                    geocoders: [{

                        url: "http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer",

                        name: "Web Address Locator",

                        placeholder: "Find address",

                        outFields: "*"

                    }],

                    map: map,

                    autoComplete: true,

                    zoomScale: 600

                }, dom.byId("search"));

                geocoder.startup();

                geocoder.on("select", showGeocodeLocation);

                function showGeocodeLocation(evt) {

                    map.graphics.clear();

                    var point = evt.result.feature.geometry;

                    var symbol = new SimpleMarkerSymbol()

                        .setStyle("square")

                        .setColor([255, 0, 0, 0.5]);

                    var graphic = new Graphic(point, symbol);

                    map.graphics.add(graphic);

                    map.infoWindow.setTitle("Search Result");

                    map.infoWindow.setContent(evt.result.name);

                    map.infoWindow.show(evt.result.feature.geometry);

                    map.infoWindow.on('hide', function () {

                        map.graphics.clear();

                        map.infoWindow.clear();

                    });

                }

                // end geocoder

0 Kudos
20 Replies
ChrisSergent
Deactivated User

Kelly,

Everything is working and ready to be rolled into my secure app.

Thanks again.

0 Kudos