Select to view content in your preferred language

Feature Layer must be visible when using editing widget?

918
3
08-23-2013 12:27 PM
IanPeebles
Frequent Contributor
I have an application where I have a couple of feature layers to edit.  They are loaded into the map.  I also have a table of contents where I have a dynamic map services that you can turn the layers on and off.  These layers are the same as what is displayed in the feature layer.  However, I do not want the feature layer on at all, so I can view the complete symbology for all graphics.

To work around my display problem, I added in the following code:

            map.addLayers([plantingsites, publictreeinventory]);
            plantingsites.hide();
            publictreeinventory.hide();

This block of code adds in the feature layer, but hides it.  I can still use the dynamic map service in the TOC to turn on and off layers.  When hiding the feature layer, the edit toolbar does not work.

Anyone have and ideas how I can hid the display of the feature layers, but still be able to use the editor widget?
0 Kudos
3 Replies
BenFousek
Deactivated User
The layer must be visible to edit, kind of...

You can still create objects with a template picker, and if you have an attribute inspector the attributes can be edited initially.  But any editing of geometry or selecting in the map requires the layer be visible.  Events that trigger editing linked to events on the graphics.

I can conceptualize some ways to possibly overcome editing with the layer hidden.  It is possible to query, select, update, etc with the layer hidden.  But it's a lot more complicated than than just having the layer visible, particularly editing geometry or interacting with the map.

I've edited attributes by identifying via map service and then making a manual call to the REST Apply Edits of the corresponding feature service to update attributes without a feature layer loaded.

You can set visible to false when creating a feature layer just like a dynamic layer instead of calling hide after adding the layer.
var layer = new esri.layers.FeatureLayer(url, {
  mode: 1,
  outFields: ['*'],
  visible: false
});
0 Kudos
BenFousek
Deactivated User
I was thinking about this some more, and I'm not at a workstation where I can test it, but I wonder if setting the feature layer mode to esri.layers.FeatureLayer.MODE_SELECTION might work.

var layer = new esri.layers.FeatureLayer(url, {
  mode: esri.layers.FeatureLayer.MODE_SELECTION,
  outFields: ['*']
});


I've never used the editor with a MODE_SELECTION layer, but I think it might be simple solution for your problem.

Don't hide the layer.
0 Kudos
JasonZou
Frequent Contributor
As Ben pointed out, I don't think you can hide the feature layers and still able to edit them. One thing you may be able to do is to display the feature layers when in edit mode only, and hide them when not. Here is the workflow at conceptual level.


  • Hide all the feature layers to be edited initially.

  • Show the feature layer(s) in edit when the app enters the edit mode. In doing so, the app should provide a way to trigger that, like click a button, or select an editing layer from a list, or click the feature template, etc.

  • Hide the feature layer(s) when the app exits the edit mode. Again, the app should have a way for doing that.

0 Kudos