Select to view content in your preferred language

Deactivate the popup opening with Editor

1542
2
08-19-2012 11:59 PM
PatrickChapuis
Emerging Contributor
API JS 3.1

Hi everyone,

I use the esri.dijit.editing.Editor to edit my layers. Unfortunately, I don't want to use the popup on the elements provided by the Editor because I have to use complex forms on my own.

But the Editor call standards popup wathever I do.

Any idea? Thanks by advance

My simplified code about the Editor
var layerInfos = new Array();
function initEditor(){
  for(var i=0; i<userConfig.layerItems.length; i++){
   var layer = map.getLayer(userConfig.layerItems.uniqueID);
   if(layer.fields!=undefined){
    var fieldInfos = dojo.map(layer.fields, function(field) {
     if (field.name === 'description') {
      return {
       'fieldName' : field.name,
       'label' : 'Details',
       stringFieldOption : esri.dijit.AttributeInspector.STRING_FIELD_OPTION_TEXTAREA
      };
     } else {
      return {
       'fieldName' : field.name,
       'label' : field.alias
      };
     }
    });
      dojo.connect(layer, "onEditsComplete", openForm);
      dojo.connect(layer, "onClick", openForm);
    
       // Ajout aux layerInfos
          layerInfos.push({
            featureLayer : layer,
            fieldInfos : fieldInfos
           });
   }
  }
      
  var params = {
   settings : {
    map : map,
    enableUndoRedo : true,
    layerInfos : layerInfos,
    toolbarVisible : true,
    createOptions : {
     polygonDrawTools : [
       esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON,
       esri.dijit.editing.Editor.CREATE_TOOL_AUTOCOMPLETE ]
    },
    toolbarOptions : {
     reshapeVisible : true,
     cutVisible : true,
     mergeVisible : true
    }
   }
  };
  editorWidget = new esri.dijit.editing.Editor(params, 'editorDiv');
  editorWidget.startup();
}

function openForm(){
 alert("Form");
 console.log(this);
}
0 Kudos
2 Replies
ab1
by
Deactivated User
Hello Patrick,

Did you find any solution to your problem? I have the same one.


Regards.
0 Kudos
KellyHutchins
Esri Notable Contributor
Here's a sample that shows how to prevent displaying the info window when you are working with the Editor and the attributes are displayed in an alternate location:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9" />
    <title>
      Default Editor
    </title>

    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
   
    <script>var dojoConfig = {parseOnLoad: true};</script>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
    
    </script>
    <style type="text/css">
      html,body {
        height:100%;
        width:100%;
        margin:0;
      }

      body {
        background-color:#fff;
        overflow:hidden;
        font-family:Helvetica;
      }

      #templatePickerPane {
        width:225px;
        overflow:hidden;
      }

      #panelHeader{
        background-color:#92A661;
        border-bottom: solid 1px #92A860;
        color:#FFF;
        font-size:18px;
        height:24px;
        line-height:22px;
        margin:0;
        overflow:hidden;
        padding:10px 10px 10px 10px;
      }
      #map {
        margin-right:5px;
        padding:0;
      }

      .esriEditor .templatePicker {
        padding-bottom:5px;
        padding-top:5px;
        height:500px;
        border-radius:0px 0px 4px 4px;
        border:solid 1px #92A661;
      }


    </style>
    <script type="text/javascript">
      dojo.require("esri.main");
      dojo.require("esri.map");
      dojo.require("esri.tasks.geometry");
      dojo.require("esri.dijit.editing.Editor");
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");


      var map;
      var editorWidget;

      function init() {
           
        //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.
        esri.config.defaults.io.proxyUrl = "http://localhost/proxy/proxy.ashx";

        //This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications
        esri.config.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");

        var extent = new esri.geometry.Extent({
          "xmin": -8576501,
          "ymin": 4705377,
          "xmax": -8574612,
          "ymax": 4706867,
          "spatialReference": {
            "wkid": 102100
          }
        });
        
      
        map = new esri.Map("map", {
          extent: extent,
          showInfoWindowOnClick:true
        });
        dojo.connect(map, "onLoad", function() {
          //resize the map when the browser resizes
          dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
        });
        dojo.connect(map, "onLayersAddResult", initEditing);
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
        map.addLayer(basemap);


        var operationsPointLayer = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/0", {
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          outFields: ["*"]
        });
        var operationsLineLayer = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/1", {
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          outFields: ["*"]
        });
        var operationsPolygonLayer = new esri.layers.FeatureLayer("http://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/HSEC/FeatureServer/2", {
          mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
          outFields: ["*"]
        });


        map.addLayers([operationsPointLayer, operationsPolygonLayer, operationsLineLayer]);
        map.infoWindow.resize(400, 300);
      }

      function initEditing(results) {
        var featureLayerInfos = dojo.map(results, function(result) {
          return {
            'featureLayer': result.layer
          };
        });
        var attInsp = new esri.dijit.AttributeInspector({
          layerInfos:featureLayerInfos
        },'attrDiv');
        
        var settings = {
          map: map,
          attributeInspector:attInsp,
          layerInfos: featureLayerInfos
        };

        var params = {
          settings: settings
        };

        editorWidget = new esri.dijit.editing.Editor(params, 'editorDiv');

        editorWidget.startup();

      }

      dojo.addOnLoad(init);
    </script>
  </head>
  
  <body class="claro">
    <div id="mainWindow" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline',gutters:false" style="width:100%; height:100%;">
      <div id="map" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'">
      </div>
      <div data-dojo-type="dijit.layout.ContentPane" id="templatePickerPane" data-dojo-props="region:'left'">
        <div id="panelHeader">
          Default Editor
        </div>
        <div style="padding:10px;" id="editorDiv">
        </div>
      </div>
      <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'" style='width:400px;'>
        <div id="panelHeader">
         Attributes
        </div>
        <div id='attrDiv'></div>
      </div>
    </div>
  </body>

</html>


0 Kudos