Yes, this is a bit tricky.  I have a solution on www.cflex.net
<http://www.cflex.net/>  and I'll post a link below, but it is not
ideal.  The issue is making it generic.  I have read since about using
classFactory and property bag to help with this but have not implemented
any of that stuff.

 

There are two steps.  One is to extend ComboBox to allow you to set the
selected index by passing in the current value of the main dataProvider
item, so that each row displays the correct selected item.  This is
complicated by the fact that the Combobox's dataProvider can be many
formats, and the "data" property can be any property of the item.  Of
course you need to know the data property in order to be able to loop
and compare its value with the main item's data.

 

The second step is to wrap that extended combo in an item renderer.
There are two scenarios for setting the dataProvider for the ComboBox
list.  One using a static dataProvider the is somewhere in a data model.
The second possibility is to have a different dataProvider for each
item/row of the main dataProvider.  This requires that the ComboBox
dataProvider data be nested within each main dataProvider item.

 

My solution supports both options, at the cost of requiring a separate
itemRender component foe each column.

 

Here is the link:

http://www.cflex.net/showFileDetails.cfm?ObjectID=767

 

Tracy

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Josh Millstein
Sent: Thursday, May 29, 2008 12:21 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] ItemRenders comboBox dataProvider

 

I'm using a comboBox as an itemEditor in an ADG. I am having a couple
issues.

1. I would like to populate the comboBox with dynamic data but anytime I
put in an value for the dataprovider which calls a bindable variable it
tells me it can't find the variable.

2. I tried to set the dataprovider from actionscript when I get the info
saying something like

pickStat.dataProvider = whatever

Problem is that I can't reference the combobox itemeditor from
actionscript
either. It has the id field specified and named pickStat.

The only think I can think is happening is that I can't reference any of
the
itemEditor stuff until it is actually displayed because it is not there
otherwise. Could this be my problem, and if so what do I do to work
around
this?

Code of itemRender and itemEditor is below

<mx:itemRenderer>
<mx:Component>

<mx:Text selectable="false" width="100%" 

text="{data.statsField}"/>
</mx:Component>

</mx:itemRenderer>


<mx:itemEditor>
<mx:Component
className="theComboBoxTwo">


<mx:VBox backgroundColor="white">

<mx:Script>
<![CDATA[

import mx.collections.ArrayCollection;

]]>
</mx:Script>

<mx:ComboBox id="pickStat"
dataProvider="{new ArrayCollection([{label: 'less than'}, {label: 'is
not
less than'}, {label: 'less than or equal to'},

{label: 'greater than'}, {label: 'is not greater than'}])}" /> 

</mx:VBox>

</mx:Component> 

</mx:itemEditor>
-- 
[EMAIL PROTECTED] <mailto:wolf%40wolffebrothers.com> 
785-832-9154

 

Reply via email to