AnsweredAssumed Answered

Show the attribute inspector without saving a new feature

Question asked by ozcandurak on Dec 29, 2016
Latest reply on Jan 3, 2017 by rscheitlin

Hi,

 

The requirement is to add a new feature from template picker but without applying it, can i show the attribute inspector than save the feature.

 

selectedTemplate = templatePicker.getSelected();

This selectedTemplate is then selected to put the points on the map than opens the attribute inspector by selecting it.

selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);

 

Sample Code Block :

  1.  dojo.connect(drawToolbar, "onDrawEnd", function(geometry) {  
  2.           //display the editable info window for newly created features  
  3.           
  4.           if (map.infoWindow.isShowing) {  
  5.             map.infoWindow.hide();  
  6.           }  
  7.   
  8.           drawToolbar.deactivate();  
  9.   
  10.           var fieldAttributes = layerFieldToAttributes(selectedTemplate.featureLayer.fields);  
  11.           var newAttributes = dojo.mixin(fieldAttributes, selectedTemplate.template.prototype.attributes);  
  12.           var newGraphic = new esri.Graphic(geometry, null, newAttributes);  
  13.   
  14.           var layerInfos = [{  
  15.             'featureLayer': selectedTemplate.featureLayer,  
  16.             'isEditable': true  
  17.           }];  
  18.   
  19.           var attInspector = new esri.dijit.AttributeInspector({  
  20.             layerInfos: layerInfos  
  21.           }, dojo.create("div"));  
  22.   
  23.           selectedTemplate.featureLayer.applyEdits([newGraphic], null, null, function() {  
  24.             var screenPoint = map.toScreen(getInfoWindowPositionPoint(newGraphic));  
  25.               
  26.             map.infoWindow.setContent(attInspector.domNode);  
  27.             map.infoWindow.resize(325, 185);  
  28.             map.infoWindow.show(screenPoint, map.getInfoWindowAnchor(screenPoint));  
  29.   
  30.             templatePicker.clearSelection();  
  31.           });  
  32.   
  33.           dojo.connect(attInspector, "onAttributeChange", function(feature, fieldName, newFieldValue) {  
  34.             feature.attributes[fieldName] = newFieldValue;  
  35.             feature.getLayer().applyEdits(null, [feature], null);  
  36.           });  
  37.   
  38.           dojo.connect(attInspector, "onDelete", function(feature) {  
  39.             feature.getLayer().applyEdits(null, null, [feature]);  
  40.             map.infoWindow.hide();  
  41.           });  
  42.         });  
  43.       }  

 

I would like my client first add the attribute to feature and (save & apply) it.

 

Any help would be appreciated. 

Outcomes