Select to view content in your preferred language

FeatureLayer setEditable() not honored after layer is loaded

1339
2
Jump to solution
03-14-2013 02:45 PM
DianaBenedict
Frequent Contributor
In my current application I load various FeatureLayers that I use for managing an edit environment.  I recently had a need to implement the FeatureLayer.setEditable(editable) and FeatureLayer.isEditable() methods to override the FeatureService capablilities. 

When the application starts, I obtain paramater information from a config object that indicates if the desired FeatureLayer is editable. This functionality is based on custom application business logic.  In the FeatureService the layer is editable but I assume that I can use the FeatureLayer.setEditable(editable) method to override the edit state so I can control when a specific FeatureLayer is editable by the user.  When I instantiate the FeatureLayer I set the FeatureLayer.setEditable(false).  I am able to review the object prior to it loading and it appears as though the _editable state = false (see image below).  After the layer is added to the map using map.addLayers() the _editable property is RESET back to true. It appears to me like it is not honoring any current edit state but rather using the edit state based on the Feature Service capabilities. 

Isn't the intent of the FeatureLayer.setEditable(editable) method to override the edit state?  Am I implementing it incorrectly? 

I know that I can go back ...loop through my edit layers within the "onLayersAddResult" handler and reset the property but that means more code.  Also, when I set the editable state, I have the object that I need at the moment that I instantiate the FeatureLayer (prior to it being added to the map.

Suggestions?

Thanks for your time.
[ATTACH=CONFIG]22620[/ATTACH][ATTACH=CONFIG]22621[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: Kelly

The setEditable method is only valid for feature layers created from a feature collection not for layers in a feature service.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html#FeatureLayer/setEditable


If you use this method on a feature service layer you should see the following message in the developer console:

FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: Kelly

The setEditable method is only valid for feature layers created from a feature collection not for layers in a feature service.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html#FeatureLayer/setEditable


If you use this method on a feature service layer you should see the following message in the developer console:

FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service
0 Kudos
DianaBenedict
Frequent Contributor
The setEditable method is only valid for feature layers created from a feature collection not for layers in a feature service.

http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/featurelayer.html#FeatureLayer/setEditable


If you use this method on a feature service layer you should see the following message in the developer console:

FeatureLayer:setEditable - this functionality is not yet supported for layer in a feature service


Kelly

Thank you for your prompt response.  I see what you mean about it only working on a FeatureCollection. For some reason I overlooked that last important part of the documentation.  Since my last post I have found a work around solution to implement my business logic.

Since I did not use the .setEditable method after I loaded the FeatureLayer, I did not see the message that you described above. However I do not doubt it. Thanks again for your help. 

Cheers
0 Kudos