Ordering of attributes in Attribute Inspector

1085
10
Jump to solution
07-05-2012 10:17 AM
AmandaHutsel
New Contributor
My attributes are in the correct order in Arc but when I run my Flex application the attributes in the Inspector are all out of order.  Also, how do you make the attributes show with their alias instead of the actual names.  Thanks.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DasaPaddock
Esri Regular Contributor
After upgrading to 3.0, the default order should be "fields", which should be the order of your outFields on your FeatureLayers or the layers published field order if you don't set the outFields or if they're set to just "*". Is that what you're seeing now?

You don't need a function since the "formFieldsOrder" property can only have three possible values.

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/AttributeInspector.html#...

View solution in original post

0 Kudos
10 Replies
DasaPaddock
Esri Regular Contributor
What version of the API are you using?

Have you tried setting AttributeInspector.formFieldsOrder?

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/AttributeInspector.html#...
0 Kudos
AmandaHutsel
New Contributor
I'm using version 2.5, and no, I have not tried this AttributeInspector.formFieldsOrder method.  I just looked it up and am quite confused as to where and how I would implement this.  Could you clarify? Thanks.
0 Kudos
DasaPaddock
Esri Regular Contributor
The possible values in 2.5 are a little different and there is a bug where "none" and "label" do the same thing:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/components/AttributeInspector.html#formIte...

Can you post your code?
0 Kudos
AmandaHutsel
New Contributor
<?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:esri="http://www.esri.com/2008/ags"
      initialize="application1_initializeHandler(event)"
      pageTitle="Editor">

<fx:Style>
  @namespace s "library://ns.adobe.com/flex/spark";
  @namespace mx "library://ns.adobe.com/flex/mx";
  @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.FeatureSet;
   import com.esri.ags.utils.GraphicUtil;
   import mx.rpc.AsyncResponder;
   import mx.controls.Alert;
  
   var eFeatureSet:FeatureSet;
   protected function doQuery():void
   {
    GraphicsLayer.clear();
   
    queryTask.execute(query, new AsyncResponder(onResult, onFault));
    function onResult(eFeatureSet:FeatureSet, token:Object = null):void
    {
     if (eFeatureSet.features.length == 0)
     {
      Alert.show("parcel not found");
     }
     else
     {
      var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(eFeatureSet.features);
      if (graphicsExtent)
      {
       myMap.extent = graphicsExtent;
      }
     }
    }
    function onFault(info:Object, token:Object = null):void
    {
     Alert.show(info.toString());
    }
   }
  ]]>
</fx:Script>


<fx:Script>
  <![CDATA[
   import mx.events.FlexEvent;
  
   protected function application1_initializeHandler(event:FlexEvent):void
   {
    myEditor.featureLayers = [ grant, historic ];
   }
  ]]>
</fx:Script>

<fx:Declarations>
  <esri:GeometryService id="myGeometryService" url="http://msgis-ags-1/ArcGIS/services/C20-amanda_hutsel/Geometry/GeometryServer"/>
  <esri:SimpleFillSymbol id="sfs" alpha="0.7" color="0xFF0000"/>
  <esri:QueryTask id="queryTask" url="http://msgis-ags-1/ArcGIS/rest/services/C20-amanda_hutsel/HighlandMapSDE3/MapServer/2" useAMF="false"/>
  <esri:Query id="query" outSpatialReference="{myMap.spatialReference}" returnGeometry="true" where="APN = {parcelText.text}">
   <esri:outFields>
    <fx:String>APN</fx:String>
   </esri:outFields>
  </esri:Query>
</fx:Declarations>
<s:BorderContainer width="370" height="560" backgroundColor="#ffffff"
        borderColor="#ff821c" borderWeight="4"
        cornerRadius="10" horizontalCenter="-456">
  <s:layout>
   <s:VerticalLayout verticalAlign="top" horizontalAlign="left" paddingLeft="10"/>
  </s:layout>
  <s:Label text="Edit" fontWeight="bold" fontSize="18" paddingTop="5"/>
  <s:TextInput id="parcelText" enter="doQuery()"/>
  <s:Button label="Find Parcel" click="doQuery()"/>
  <s:Label paddingBottom="20"/>
  <esri:Editor id="myEditor"
      width="100%" height="250"
      geometryService="{myGeometryService}"
      map="{myMap}"/>
 
</s:BorderContainer>
<s:BorderContainer width="950" height="560" cornerRadius="10"
        borderStyle="inset" horizontalCenter="228">
  <s:borderStroke>
   <s:SolidColorStroke color="#00923f" weight="4"/>
  </s:borderStroke>
  <esri:Map id="myMap" x="0" top="5" height="540" right="5" left="5" bottom="5" horizontalCenter="0">
   <esri:extent>
    <esri:Extent xmin="-13049723" ymin="4043802" xmax="-13042275" ymax="4046486">
     <esri:SpatialReference wkid="102100"/>
    </esri:Extent>
   </esri:extent>
   <esri:ArcGISTiledMapServiceLayer url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
   <esri:FeatureLayer id="grant"
          mode="snapshot"
          outFields="[LName, Fname, Street_Address, Parcel_Number, Grant_Program, Grant_Amount, Escrow_Date, Reconveyance_Date, PaidByHomeowner]"
          url="http://msgis-ags-1/ArcGIS/rest/services/C20-amanda_hutsel/HighlandMapSDE3/FeatureServer/1">
    <esri:renderer>
     <esri:UniqueValueRenderer>
      <esri:defaultSymbol>
       <esri:SimpleMarkerSymbol color="#00FF00" style="diamond" size="12"/>
      </esri:defaultSymbol>
     </esri:UniqueValueRenderer>
    </esri:renderer>
   </esri:FeatureLayer>
   <esri:FeatureLayer id="historic"
          mode="snapshot"
          outFields="[ReferenceNo, Street_Address, AssessorParcelNo, ConStatus, CertificateOfAppropriateness]"
          url="http://msgis-ags-1/ArcGIS/rest/services/C20-amanda_hutsel/HighlandMapSDE3/FeatureServer/0">
    <esri:renderer>
     <esri:UniqueValueRenderer>
      <esri:defaultSymbol>
       <esri:SimpleMarkerSymbol color="#61280E" style="square" size="12"/>
      </esri:defaultSymbol>
     </esri:UniqueValueRenderer>
    </esri:renderer>
   </esri:FeatureLayer>
   <esri:GraphicsLayer id="GraphicsLayer" graphicProvider="{queryTask.executeLastResult.features}" symbol="{sfs}"/>
  </esri:Map>
</s:BorderContainer>
</s:Application>
0 Kudos
DasaPaddock
Esri Regular Contributor
You can get to the Editor's AttributeInspector using the "attributeInspector" property:
http://help.arcgis.com/en/webapi/flex/apiref/com/esri/ags/components/Editor.html#attributeInspector

Is it currently sorted alphabetically?
0 Kudos
AmandaHutsel
New Contributor
Yes, they are sorted alphabetically now.

How exactly do I code the body of the function?

protected function getFormItemLabel(featureLayer:FeatureLayer, field:Field, fieldInspector:FieldInspector):String
{
what do I put here?
}
0 Kudos
DasaPaddock
Esri Regular Contributor
Where did the getFormItemLabel function come from? Are you OK with the sorting now? Can you upgrade to the 3.0 API?
0 Kudos
AmandaHutsel
New Contributor
No, I still can figure this out.  The getFormItemLabel function  came from the formsFieldOrder property on the AttributeInspector page of the API reference.
http://resources.arcgis.com/en/help/flex-api/apiref/index.html

Yes, I have upgraded to 3.0.
0 Kudos
DasaPaddock
Esri Regular Contributor
After upgrading to 3.0, the default order should be "fields", which should be the order of your outFields on your FeatureLayers or the layers published field order if you don't set the outFields or if they're set to just "*". Is that what you're seeing now?

You don't need a function since the "formFieldsOrder" property can only have three possible values.

See:
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/components/AttributeInspector.html#...
0 Kudos