function initInfoWindow(results){ console.log("in the initInfoWindow function: " + globals.map.layerIds.length); globals.query = new Query(); globals.eventsMSL.on("click", function(evt){ if (globals.map.infoWindow.isShowing) { globals.map.infoWindow.hide(); }; var layerInfos = [{ 'featureLayer': globals.eventsMSL, 'isEditable': false, 'showAttachments': false, 'showDeleteButton':false }] var attInspector = new esri.dijit.AttributeInspector({ layerInfos: layerInfos }, dojo.create("div")); globals.query.objectIds = [evt.graphic.attributes.OBJECTID]; globals.eventsMSL.selectFeatures(globals.query, FeatureLayer.SELECTION_NEW, function(features){ globals.map.infoWindow.setTitle(""); globals.map.infoWindow.setContent(attInspector.domNode); globals.map.infoWindow.resize(350, 240); globals.map.infoWindow.show(evt.screenPoint, globals.map.getInfoWindowAnchor(evt.screenPoint)); var editButton = new Button({ label: "Edit", "class": "editButton" }); domConstruct.place(editButton.domNode, attInspector.deleteBtn.domNode, "after"); editButton.on("click", function() { editMode(features); }); }); }); }
function editMode(features){ if (globals.map.infoWindow.isShowing) { globals.map.infoWindow.hide(); } var layerInfos = [{ 'featureLayer': globals.eventsMSL, 'isEditable': true }]; var attInspector = new esri.dijit.AttributeInspector({ layerInfos: layerInfos }, dojo.create("div")); var editScreenPoint = globals.evt.screenPoint; globals.map.infoWindow.setContent(attInspector.domNode); globals.map.infoWindow.resize(325, 185); globals.map.infoWindow.show(editScreenPoint, globals.map.getInfoWindowAnchor(editScreenPoint)); attInspector.on("delete", function(evt) { globals.map.infoWindow.hide(); }); attInspector.on("attribute-change", function(evt) { }); }
Solved! Go to Solution.
function editMode(features){ var layerInfos = [{ 'featureLayer': globals.eventsMSL, 'isEditable': true }]; var attInspector = new esri.dijit.AttributeInspector({ layerInfos: layerInfos }, dojo.create("div")); globals.eventsMSL.selectFeatures(globals.query, FeatureLayer.SELECTION_NEW, function(editFeatures){ if (globals.map.infoWindow.isShowing) { globals.map.infoWindow.hide(); } var editScreenPoint = globals.map.toScreen(editFeatures[0].geometry); globals.map.infoWindow.setContent(attInspector.domNode); globals.map.infoWindow.resize(325, 185); globals.map.infoWindow.show(editScreenPoint, globals.map.getInfoWindowAnchor(editScreenPoint)); attInspector.on("delete", function(evt) { globals.map.infoWindow.hide(); }); attInspector.on("attribute-change", function(evt) { }); }); }