Finally figured it out: It was a scope problem. <mx:component> has its own scope which explains why nothing beyond your parents (editor host) “data” object is visible. If you want to use an inline itemEditor that is data bound to other dynamic sources than the hosting component’s dataProvider, such as an XML for example, you just use the “outerDocument” keyword as a prefix. The following is an example for an inline itemEditor combobox that gets its own data independently from the host.... (hope this helps someone to learn faster than me ;-) )

 

    <mx:Component id="inlineEditor">

<mx:ComboBox labelField="lastName" dataProvider="{outerDocument.userInfo.lastResult.users.user}"/>

    </mx:Component>                  

 


From: [email protected] [mailto:[email protected]] On Behalf Of Aaron West
Sent: Wednesday, October 18, 2006 12:17 PM
To: [email protected]
Subject: Re: [flexcoders] Another DataGrid itemEditor ComboBox challenge

 

I ran into this same problem with item renderers and item editors and
DataGrid's. The only thing I could think of was the item renderers/editors
only exist in the runtime context and therefore cannot reference any
variables defined in ActionScript in your MXML file. I solved this problem
by _not_ using an inline editor and instead writing my own component
in a separate AS file. If you're more comfortable with MXML you can
write your component in MXML code instead of AS3. You'll get much more
leverage and control if you use AS3.

Here's an example:

// DataGrid column looks like this (showing only relevant attributes):
// The all caps "location name" is the value returned from a Web service
// call bound to the DataGrid itself.
<mx:DataGridColumn dataField="LOCATIONNAME" itemEditor="components.LocationNameComboBox"/>

// LocationNameComboBox.as (stored in the "components" directory):
package components {
     import mx.controls.ComboBox;
     import mx.core.Application;
 
     public class LocationNameComboBox extends ComboBox
     {
          public function LocationNameComboBox()
          {
               super();
               dataProvider = Application.application.overrideLocationList;
               enabled = false;
          }
           
     }
}

In the AS3 code, notice I import mx.core.Application and then use the appropriate
code to reference an ArrayCollection (overrideLocationList) that exists in the main
MXML application code. This means my custom ComboBox component is
tightly coupled to my main application but this was the best I could come up with.
I'm sure someone with more experience could offer a better way.


| Aaron West
| aaron AT trajiklyhip DOT com
| http://www.trajiklyhip.com/blog/
| Certified Advanced Adobe ColdFusion MX 7 Developer
| Certified Macromedia FlashMX Developer
| Adobe Community Expert


On Oct 18, 2006, at 1:32 PM, iko_knyphausen wrote:


I am trying to use a drop-down combo as itemEditor for a datagrid
column. Everything is honkey-dory when the itemEditor is defined as a
component (like the inlineEditor example in the docs) with static array
of strings (or objects, if you want). Trouble comes into paradise when
you want to have the itemEditor itself retrieve its data dynamically via
dataProvider binding to a different source, such as XML, etc. All my
attempts lead to a compile error 1120: Access of undefined property.

Any ideas - thanks





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)

<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to