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.
<SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">selectedTemplate </SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">=</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;"> templatePicker</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">.</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">getSelected</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">();</SPAN>
This selectedTemplate is then selected to put the points on the map than opens the attribute inspector by selecting it.
<SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">selectedTemplate</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">.</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">featureLayer</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">.</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">applyEdits</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">([</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;">newGraphic</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">],</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;"> </SPAN><SPAN class="" style="color: #8a4a0b; border: 0px; font-weight: inherit; font-size: 12px;">null</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">,</SPAN><SPAN class="" style="color: #000000; border: 0px; font-weight: inherit; font-size: 12px;"> </SPAN><SPAN class="" style="color: #8a4a0b; border: 0px; font-weight: inherit; font-size: 12px;">null</SPAN><SPAN class="" style="color: #145680; border: 0px; font-weight: inherit; font-size: 12px;">);</SPAN>
Sample Code Block :
- dojo.connect(drawToolbar, "onDrawEnd", function(geometry) {
- //display the editable info window for newly created features
-
- if (map.infoWindow.isShowing) {
- map.infoWindow.hide();
- }
-
- drawToolbar.deactivate();
-
- var fieldAttributes = layerFieldToAttributes(selectedTemplate.featureLayer.fields);
- var newAttributes = dojo.mixin(fieldAttributes, selectedTemplate.template.prototype.attributes);
- var newGraphic = new esri.Graphic(geometry, null, newAttributes);
-
- var layerInfos = [{
- 'featureLayer': selectedTemplate.featureLayer,
- 'isEditable': true
- }];
-
- var attInspector = new esri.dijit.AttributeInspector({
- layerInfos: layerInfos
- }, dojo.create("div"));
-
- selectedTemplate.featureLayer.applyEdits([newGraphic], null, null, function() {
- var screenPoint = map.toScreen(getInfoWindowPositionPoint(newGraphic));
-
- map.infoWindow.setContent(attInspector.domNode);
- map.infoWindow.resize(325, 185);
- map.infoWindow.show(screenPoint, map.getInfoWindowAnchor(screenPoint));
-
- templatePicker.clearSelection();
- });
-
- dojo.connect(attInspector, "onAttributeChange", function(feature, fieldName, newFieldValue) {
- feature.attributes[fieldName] = newFieldValue;
- feature.getLayer().applyEdits(null, [feature], null);
- });
-
- dojo.connect(attInspector, "onDelete", function(feature) {
- feature.getLayer().applyEdits(null, null, [feature]);
- map.infoWindow.hide();
- });
- });
- }
I would like my client first add the attribute to feature and (save & apply) it.
Any help would be appreciated.