problems editing in flex

1926
4
05-06-2011 12:50 PM
JasonTrook
New Contributor II
Hi All,

I'm fairly new to the Flex API and was hoping to get some help to my questions.  I want to be able to edit some of our SDE layers within a Flex application.  I copied/pasted ESRI's default editor sample into Adobe Flash and got everything to display correctly.  However, when I switch out the feature layer and point to our SDE data the layers display on the map but the window showing the feature layers and their symbology is empty.  Any ideas for getting the layers to display for editing?  I've created templates for all the feature layers but this didn't work.

Also, I receive a warning with the original code about the esri|InfoWindow - could not resolve namespace qualified type 'InfoWindow' in CSS selector 'InfoWindow'

and an error message pointing to wrapAround180="true" (cannot resolve attribute for component type com.esri.ags.Map) which I had to remove.  Is this related to my problem?

Thanks,

Jason
Tags (2)
0 Kudos
4 Replies
by Anonymous User
Not applicable
There are a few basic things to check for in this situation.  Editing via the Web APIs is dependent on ArcGIS Server 10.x versions.  Editing was not supported prior to version 10 in the Web APIs.  Also regarding wrapAround180 this is only applicable when the map is in geographic and web Mercator projections.

Would you share how you've switched out the feature layer and pointed to your SDE data layers?  Also a few screen shots of the errors would be helpful so we can see what's happening.   

Regards,
Doug Carroll, ESRI Support Services SDK Team
http://support.esri.com/
0 Kudos
JasonTrook
New Contributor II
Hi Doug,

Within ArcGIS Server we created are own geometry service.  Our map service has feature access enabled.  Within the .mxd we are able to edit the features.  We have tried all the edit feature code samples but none work.  Attached is our code:


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      xmlns:esri="http://www.esri.com/2008/ags"
      initialize="application1_initializeHandler(event)"
      pageTitle="Editor with all toolbar options">
<!--
This sample shows you how to use the editor component with a full toolbar.
-->

<fx:Style>
  @namespace esri "http://www.esri.com/2008/ags";
 
  esri|InfoWindow
  {
   background-color : #FFFFFF;
   border-thickness : 2;
  }
</fx:Style>

<fx:Script>
  <![CDATA[
   import com.esri.ags.components.supportClasses.CreateOptions;
   import com.esri.ags.tasks.GeometryService;
   import com.esri.ags.tools.DrawTool;
  
   import mx.events.FlexEvent;
  
   protected function application1_initializeHandler(event:FlexEvent):void
   {
    myEditor.featureLayers = [ fireAreas ];
    var myDrawTypePreferences:CreateOptions = new CreateOptions();
    // change the defauls drawing tool from "point-to-point" to "freehand"
    myDrawTypePreferences.polygonDrawTools = [ DrawTool.FREEHAND_POLYGON, DrawTool.POLYLINE, CreateOptions.AUTO_COMPLETE ];
    myEditor.createOptions = myDrawTypePreferences;
   }
  ]]>
</fx:Script>

<mx:VBox width="100%" height="100%">
 
  <esri:Map id="myMap">
   <esri:extent>
    <esri:Extent id="sheepfire"
        xmin="487618.346176688" ymin="5206894.92732008" xmax="527264.665143855" ymax="5241981.53318966">
     <esri:SpatialReference wkid="26911"/>
    </esri:Extent>
   </esri:extent>
<!--   <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>-->
   <esri:FeatureLayer id="fireAreas"
          mode="snapshot"
          outFields="*"
          url="http://gis.cdatribe-nsn.gov/ArcGIS/rest/services/TestEditService/MapServer/2"/>
  </esri:Map>
  <esri:Editor id="myEditor"
      width="100%"
      height="50%"
      geometryService="{new GeometryService('http://gis.cdatribe-nsn.gov/ArcGIS/rest/services/Geometry/GeometryServer')}"
      map="{myMap}"
      toolbarCutVisible="true"
      toolbarMergeVisible="true"
      toolbarReshapeVisible="true"
      toolbarVisible="true"/>
 
</mx:VBox>
</s:Application>
0 Kudos
by Anonymous User
Not applicable
Hi Jason,

At a glance it looks like your're trying to Edit your Map Service endpoint, as opposed to your Feature Service endpoint.

Make sure you target the feature service endpoint in the map.  Feature Service exposes feature editing, such as add, update and delete.  Map services are for visualization.

    ex. http://gis.cdatribe-nsn.gov/ArcGIS/rest/services/TestEditService/FeatureServer/2

Regards,
Doug Carroll, ESRI Support Services SDK Team
http://support.esri.com/
0 Kudos
JasonTrook
New Contributor II
Hi Doug,
Your suggestion fixed my problem...Thanks.
However, when I view the attribute table the fields are all out of order (one layer is alphabetized and the other is randomly organized) and don't correspond to the SDE table.  Any ideas?
Also, after I draw a polygon no attribute table appears and the edits are not saved.

Thanks,

Jason
0 Kudos