Select to view content in your preferred language

Unexpected behavior after changing AttributeEditor example

2362
2
04-09-2014 02:19 PM
JackSchoenmakers
Deactivated User
The app shows a datalayer with polygons and with table values that are editable. The layer is added twice for visualization purposes.

After testing the original code and changing the data layers my app only shows polygon objects after I changed the table values.

Original part:

dmsl = new ArcGISDynamicMapServiceLayer("http://sampleserver .arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/MapServer");
mapView.addLayer(dmsl);

featureLayer = new ArcGISFeatureLayer
("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSFields/FeatureServer/0",
MODE.SELECTION);

This works as expected. I modified it to:

dmsl = new ArcGISDynamicMapServiceLayer("http://services1.arcgis.com/......./ArcGIS/rest/services/......./FeatureServer/2");
mapView.addLayer(dmsl);

featureLayer = new ArcGISFeatureLayer("http://services1.arcgis.com/..../ArcGIS/rest/services/......./FeatureServer/2", MODE.SELECTION);

mapView.addLayer(featureLayer);

While I don't have an (ArcGIS Server) Mapserver version of the data layer I add it twice from ArcGIS Online. It is a data layer with public rights. What would be the correct solution ?
0 Kudos
2 Replies
RobertBurke
Esri Contributor
Hi Jack,

It looks like you are using a URL that points to hosted FeatureService that you published to ArcGIS Online.  If that is true then the line of code that defines the dmsl variable is using that ArcGISDynamicMapServiceLayer class, but is passing in a FeatureService.  You could change the class to ArcGISFeatureLayer and add a MODE for the second argument. Then that layer should display.

displayFeatureLayer = new ArcGISFeatureLayer("http://services1.arcgis.com/......./ArcGIS/rest/services/......./FeatureServer/2",
MODE.SNAPSHOT );
mapView.addLayer(displayFeatureLayer);

Please let me know if I am understanding the situation correctly and if this helps.
Rob Burke
0 Kudos
JackSchoenmakers
Deactivated User
Thanks for your answer. Indeed, changing the code like you suggested makes the original polygons visible.

featureLayer0 = new ArcGISFeatureLayer("http://services1.arcgis.com/..../ArcGIS/rest/services/..../FeatureServer/2", MODE.SNAPSHOT);
mapView.addLayer(featureLayer0);

featureLayer = new ArcGISFeatureLayer("http://services1.arcgis.com/...../ArcGIS/rest/services/...../FeatureServer/2", MODE.SELECTION);

mapView.addLayer(featureLayer);

This last line is additional too compared to the original code. It's now almost functioning as it should.

After changing attribute values that define the symbology the new symbology is not yet consequently changed.
I replaced one of the last lines in the original code:

dmsl.refresh();

with:

featureLayer.refresh();

It seems that changes are only effectively shown after first choosing Apply and then Edit again followed by Discard.
Strange but less problematic. Replacing the code with featureLayer0.refresh(); didn't help. Somewhere I missed the logic behind this.

Despite this using the samples is very effective for extending my knowledge.
0 Kudos