Disable Editing Geometry of Features

3038
3
07-19-2011 10:24 AM
AaronDrake
New Contributor
Is there a simple way to disable the ability to edit the geometry of features in a FeatureLayer?  Essentially I want to load 3-5 layers in to my application, and disable the ability to add, delete, move, etc any of the features; however, I want the users to be able to update the attributes of the features.

I am working with the following sample:
http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples_start.htm

In this sample there is only one layer that is being edited.  How would you do more than one?

I tried the following to change the FeatureLayer, but the attributes do not show up in the InfoWindow after I switch the FL.

FLEdit1 = "http://myserver.com/ArcGIS/rest/services/fledit1/0"
FLEdit2 = "http://myserver.com/ArcGIS/rest/services/fledit1/1"

function editSetLayer (strFeatureLayer){
 
 FL = new esri.layers.FeatureLayer(strFeatureLayer, {
  mode: esri.layers.FeatureLayer.MODE_SELECTION,
  outFields: ["*"]
 });
 
 markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 15, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 255]), 0.5), new dojo.Color([0, 255, 255, 0.5]));

 FL.setSelectionSymbol(markerSymbol);
 
};

editSetLayer(FLEdit1);



Any help is greatly appreciated...
0 Kudos
3 Replies
derekswingley1
Frequent Contributor
Yes, you can do this by using the attribute inspector. See this sample:  Using the Attribute Inspector. To edit multiple layers, add additional objects to the layerInfos array.
0 Kudos
ShaningYu
Frequent Contributor
swingley:
The Attribute Inspector appears to be wonderful.  I would like to have 2 general Q's:
1)  It should be also applicable for JS Extension for Google Maps API's application.
If the layer is an esri.layers.FeatureLayer, this method used in the tool should be able to apply for.  True or false?
2)  If I add a .gpx file (converted from a shapefile, gpx is actually an xml file) on the map, can this be layer be defined as an esri.layers.FeatureLayer?
Thanks for your attention.
Yours,
Shaning
0 Kudos
AaronDrake
New Contributor
Thanks...

I was able to add a second layer to the layerInfos array; however, now I need to be able to select features in this second layer.  In the example it is set to select only from the petroFieldsFL.  It needs to select from all of the FL's I load into the map, or from a layer the user specifies.  I can manually change it from petroFieldsFL to myFL, and it works. 

I just need to be able to do it dynamically...
0 Kudos