Select to view content in your preferred language

How to create attribute inspectors inspectorFields with actionscript?

1014
2
Jump to solution
02-07-2012 03:05 AM
MarttiKostia
Emerging Contributor
Hello.

I need to create an attribute inspector window with actionscript, because the field inspectors need to be created dynamically.

In mxml, I can just go

  <esri:FieldInspector id="myFieldInspector" featureLayer="{myLayer}" fieldName="MYFIELD"  label="My Field">    <esri:renderer>     <fx:Component>      <esri:DropDownListField>       <esri:dataProvider>        <s:ArrayCollection>         <fx:Object label="Red" value="RED"/>         <fx:Object label="Green" value="GREEN"/>        </s:ArrayCollection>       </esri:dataProvider>      </esri:DropDownListField>     </fx:Component>    </esri:renderer>   </esri:FieldInspector>.

In actionscript, I can go:

myFieldInspector.renderer = myFieldInspectorRenderer, and then do the renderer in a separate mxml.

The fieldInspector should be a textInput or a textArea, and changes to those fields should go to the database.

What should the renderer contain for this? The fieldInspector has correct the featurelayer and the field name.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MarttiKostia
Emerging Contributor
Thank you Robert,

I did look at that thread first, but I couldn't figure out from the answers how the data in the renderer's textInput gets stored into the db.

I figured it out though: the renderer can be a standard item renderer:

<?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer 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:managers="com.esri.viewer.managers.*"     autoDrawBackground="true"      width="100%" xmlns:esri="http://www.esri.com/2008/ags"     >  <fx:Script>   <![CDATA[        override public function set data(value:Object):void {     if (value) input.text = String(value);    }      ]]>  </fx:Script>    <esri:StringField id="input" width="200" />     </s:ItemRenderer> 


With the exception that I use <esri:StringField> instead of spark textinput.

Apparently the StringField manages to do the trigger the submitting to database automatically.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Martti,

   See this thread for an example:

http://forums.arcgis.com/threads/19995-Easiest-way-to-customize-AttributeInspector-associated-with-a...

Don't forget to click the Mark as answer check and to click the top arrow (promote) as shown below:
0 Kudos
MarttiKostia
Emerging Contributor
Thank you Robert,

I did look at that thread first, but I couldn't figure out from the answers how the data in the renderer's textInput gets stored into the db.

I figured it out though: the renderer can be a standard item renderer:

<?xml version="1.0" encoding="utf-8"?> <s:ItemRenderer 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:managers="com.esri.viewer.managers.*"     autoDrawBackground="true"      width="100%" xmlns:esri="http://www.esri.com/2008/ags"     >  <fx:Script>   <![CDATA[        override public function set data(value:Object):void {     if (value) input.text = String(value);    }      ]]>  </fx:Script>    <esri:StringField id="input" width="200" />     </s:ItemRenderer> 


With the exception that I use <esri:StringField> instead of spark textinput.

Apparently the StringField manages to do the trigger the submitting to database automatically.
0 Kudos