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 :
I would like my client first add the attribute to feature and (save & apply) it.
Any help would be appreciated.
Any one ? Robert Scheitlin, GISP
Ozcan,
These lines are what create the feature in the feature layer:
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();
});
So just call all the code (lines 2 - 😎 without lines 1 and 9 and then once you add a save button to your Attribute Inspector then you can:
selectedTemplate.featureLayer.applyEdits([newGraphic], null, null);
here is a thread showing how to add the save button to the Attribute Inspector:
Hi Robert,
Thanks for the reply.
My question is not to open the attribute inspector after applying the edits. I would like to first create the feature on map and open the attribue inspector, once all my fields has been filled than i would like to apply and send it to server.
That is exactly what I understood and advised in my last reply.
Hi rscheitlin,
Here is the sample i have tried, Dropbox - index-2.html.zip
Please have look at it.
Regards.
Hi Robert,
I have tried many times, but had no success,
the attribute inspector is opening but there isn't any content contains. When creating a feature from templatePicker the feature has no objectId yet, therefore until i save i cannot get objectId and cannot use selectFeature. My aim is to save the data to server after i finish with it attributes.
Can you please share a sample if possible.
Best Regards.
Ozcan,
The OID will not get assigned until you save the feature to the FeatureService. A selectFeature call can not be used until the feature service has a feature back on the server. You should be able to do all you attribute working in the attribute inspector and then once you are done applying your attributes you use layer.applyEdits([graphic], null, null); to save it to the service.