Hi Barry 
a suggestion: extend the datagridcolumn as well to include 
a "rendererDataProvider" property eg

myDataGridColumn.mxml
---------------------
<mx:DataGridColumn>
<mx:Script>
public var rendererDataProvider:Object;
</mx:Script>
</mx:DataGridColumn>

then do this - 
<myDataGridColumn headerText="Role" 
itemRenderer="custom_controls.ComboBox" 
rendererDataProvider="colRole"/>
<myDataGridColumn headerText="Type"
 itemRenderer="custom_controls.ComboBox" 
rendererDataProvider="colEvalType"/> //not sure sbout binding

then in your custom_controls.ComboBox (intialize or creationComplete 
event) set the dataprovider

eg
private function comboInitialize():void
{
  var myListData:DataGridListData = DataGridListData(this.listData);
  var datagrid1:DataGrid = DataGrid(myListData.owner);
  
//extract rendererDataProvider from the column                  
        
var dp:Object = datagrid1.columns
[myListData.columnIndex].rendererDataProvider;
  
  // now set the dataprovider based on lookup value
  this.dataProvider = dp;
}
this is very raw but it can be made to work.
regards
bod




--- In flexcoders@yahoogroups.com, "Barry Beattie" 
<[EMAIL PROTECTED]> wrote:
>
> well, the origional post went down like a lead dirigeable.... I'll
> back up a bit and try to explain better...
> 
> I have query data that I want to edit in a datagrid, mostly to 
utilise
> the textbox-type features. However...
> 
> two columns are look-up data, best represented by ComboBox's. it 
looks
> like I can use itemRenderers for the cells in these columns. What 
I'm
> stuck on is the best way to bind the look-up data to the ComboBox's
> when they're used as itemRenderers.
> 
> because I want to extend the ComboBox's anyway, I could (in theory)
> have these as custom components and bind the dynamic data directly 
to
> each within the custom control mxml - hard wired in. but If I want 
to
> use the same control for both columns but with different data, I'm
> stuck
> 
> is there any way of keeping the custom controls "dumb" and, from 
the
> datagrid's level, tell the itemRenderers what look-up data model to
> bind to?
> 
> something like this:
> 
> <mx:DataGridColumn headerText="Role"
> itemRenderer="custom_controls.ComboBox" 
rendererDataProvider="{colRole}"/>
> <mx:DataGridColumn headerText="Type"
> itemRenderer="custom_controls.ComboBox" 
rendereDataProvider="{colEvalType}"/>
> 
> is (something like) this possible? is there a better way?
> How can comboBoxes with dynamic data be integrated with DataGrids?
> 
> any suggestions most welcome.
> thanx
> barry.b
> 
> PS: I suspect that this is only half the battle. Getting the 
DataGrids
> data model to store the  ComboBox selection might be the other 
half...
> 
> 
> 
> > datagrid's itemRenderer's dataProvider?
> >     Posted by: "Barry Beattie" [EMAIL PROTECTED] barry.beattie
> >     Date: Wed Aug 16, 2006 10:23 pm (PDT)
> >
> > hi all
> >
> > I've got a datagrid where I'll have columns of ComboBoxes, 
populated
> > with dynamic data (look-up tables really).
> >
> > sure I can assign a DataGridColumn's itemRenderer to a custom 
control,
> > but if I want to re-use that control, how do I pass a different
> > dataProvider to it?
> >
> > in other words:
> >
> > having these controls
> > <my:ComboBox dataProvider="{colRole}" y="100"></my:ComboBox>
> > <my:ComboBox dataProvider="{colEvalType}" y="120"></my:ComboBox>
> >
> > as itemRenderers
> > <mx:DataGridColumn headerText="Role" 
itemRenderer="custom_controls.ComboBox"/>
> > <mx:DataGridColumn headerText="Type" 
itemRenderer="custom_controls.ComboBox"/>
> >
> > or is this a dumb idea and there's a better way?
> >
> > thanx
> > barry.b
>






--
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/

<*> 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/
 



Reply via email to