Flex Editor - Editing Tables

1886
7
04-14-2010 08:05 AM
JoseSousa
Esri Contributor
Dear ArcGIS API Flex Team,

Is it possible to edit a table exposed by a service from ArcGIS Server using the Flex Editor tools?

Thanks advanced,

José Sousa
ESRI Portugal
Tags (2)
0 Kudos
7 Replies
BjornSvensson
Esri Regular Contributor
The AttributeInspector component works fine with editing tables, but the Editor component does not.
0 Kudos
JoseSousa
Esri Contributor
Hello Bjorn,

Thanks for your reply.
I am a little bit surprised with your answer (in a good way :w).
I was reading the ArcGIS Flex API reference for the AttributeInspector and the inputs are FeatureLayers exposed (I suppose) from a FeatureServer. The FeatureServer cannot expose a table. I can only access this resource through a MapService (for instance ArcGISDynamicLayer).

While the FeatureLayer can be both a layer from a FeatureServer or  from a MapService I was expecting that editing functionality would only be supported when using a FeatureServer.

From your explanation, I am understanding that I can use the AttributeInspector using FeatureLayers (from FeatureServer) and FeatureLayers (from MapService - both layers and tables).

If this is true, the attribute name FeatureLayers in the AttributeInspector and FieldInspector should change to a more friendly name 🙂

Can you confirm this Bjorn?

Thanks a lot again
0 Kudos
BjornSvensson
Esri Regular Contributor
The Feature Service does support both "layers" and "tables".  See for example http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer.

Yes, FeatureLayer works with layers from both Map Services and Feature Services, but they are only editable if it is an editable layer from a Feature Service.  See for example http://help.arcgis.com/en/webapi/flex/samples/index.html?sample=AttributeInspectorInfoWindowViewonly for using AttributeInspector with a layer from a MapService (which are never editable).  Maybe what is confusing is the bug where in this example it seems like you can edit the data, but that's an issue with the fields in the AttributeInspector (which should be non-editable).  When you change something here, nothing actually gets saved (or sent) to the server.  The bug is that AttributeInspector seems editable even for non-editing layers, it should not. See http://wikis.esri.com/wiki/display/ag94b/Web+Mapping+APIs+%28JavaScript%2C+Flex%2C+Silverlight%29#We... for known issues with Flex API 2.0 beta.

Yes, FeatureLayer could be thought of as "FeatureLayerOrTable" or maybe better FeatureLayer-based-on-a-layer-or-a-table 🙂

Any specific suggestions for how to improve our "API Reference" and "Concepts" greatly appreciated...
0 Kudos
JoseSousa
Esri Contributor
Bjorn,

Much appreciated for the excellent explanation. I tried some weeks ago to publish a table for editing purposes expecting that it would become exposed by the FeatureServer but I haven't been able to achieve it.

Now that I have seen that it really works I'll try to figure it out where it failed.

Thanks a lot,

José Sousa
ESRI Portugal
0 Kudos
MathieuVILLEMONT1
Occasional Contributor
Hi,

So how can we do that ?
When I add it manually to the InfoWindow it does not show up 😞

var attr:AttributeInspector  = new AttributeInspector();
attr.featureLayers = [featLayer];
var g:Graphic = new Graphic();
var attributes:Object = {};
g.attributes = attributes;
attr.showFeature(g, featLayer);
attr.visible = true;
attr.updateEnabled = true;
map.infoWindow.visible = true;
map.infoWindow.content = attr;


Am I missing something ?

Thanks

Mathieu
0 Kudos
MathieuVILLEMONT1
Occasional Contributor
After some research it appears the problem comes from the FeatureLayer instanciation.

When I add it statically it works :

<esri:FeatureLayer id="citizen"
     outFields="
  • "
  •      url="http://..."/>


    When I add it dynamically it does not :

    var featLayer:FeatureLayer = new FeatureLayer("http://...", null, null);
    featLayer.outFields = ["*"];


    My problem is I must add it dynamically...

    Any idea how to get the same results ?
    0 Kudos
    MathieuVILLEMONT1
    Occasional Contributor
    OK I think my problem was that the layer was not loaded and therefore did not have any featureDetails.
    I found the solution on this thread.

    Thank you Robert and Walt!
    0 Kudos