Well, i think i understand why the "undefined property" message appears. The compiler creates a class during compilation to represent the itemRender for the dataGridColumn, and any properties you set in the inline mxml code get placed in this class, but this class has no reference to the document in which the dataGrid itself is contained and therefore can't make any sense of anything outside its own scope. Now that I know that, it doesn't seem very possible to me to make a reusable comboBox itemRender whose dataProvider, labelField, and dataFields are generic. Has anyone else been here?
Thanks, Rick --- In flexcoders@yahoogroups.com, "livinginswitzerland" <[EMAIL PROTECTED]> wrote: > > I'm being bit by this same situation. Many of my datagrids will > contain columns which need to be edited/rendered using a custom > comboBox control. I want to create a reusable comboBox control that > does what I think the comboBox should already do for me but doesn't. > It seems to me the way to go here is to create your own subclassed > comboBox, then configure it by using it as an inline itemRenderer for > a dataGridColumn... but I am also running into the "access of > undefined property" problem. my TileWindow mxml file contains an > ArrayCollection populated by a database read. I want this > ArrayCollection to be passed into my custom ComboBox control > itemRenderer to be used as it's dataProvider. see code below: (myDP > is a property defined within my custom comboBox component, myArray is > the ArrayCollection property contained within my TileWindow.mxml file) > > <mx:DataGrid editable="true" id="dgInvestigators" height="196" > width="100%" > > <mx:columns> > <mx:DataGridColumn width="125" editable="false" > dataField="pi_first" headerText="First Name"/> > <mx:DataGridColumn width="125" editable="false" > dataField="pi_last" headerText="Last Name"/> > <mx:DataGridColumn id="dgDeptCol" width="317" > headerText="Department" dataField="dept_id" > > <mx:itemRenderer> > <mx:Component> > <framework:irComboBox myDP="{myArray}" > </mx:Component> > </mx:itemRenderer> > </mx:DataGridColumn> > </mx:columns> > </mx:DataGrid> > > Yet, the compiler tells me the reference to myArray is invalid. What > gives here? (is it me, or are comboBoxes just half baked?) :) > > Thanks, > > Rick > > > --- In flexcoders@yahoogroups.com, "bhaq1972" <mbhaque@> wrote: > > > > yes it is out of scope. a way round this (may not be totally > > desirable) as follows > > > > <mx:DataGridColumn headerText="Type" dataField="col3"> > > <mx:itemRenderer> > > <mx:Component> > > <mx:ComboBox creationComplete="doThis()"> > > <mx:Script><![CDATA[ > > > > private function doThis():void > > { > > // need to go up the owner/parent chain until > > // you get access to colEvalType and set > this.dataProvider > > > > > > } > > ]]></mx:Script> > > </mx:ComboBox> > > </mx:Component> > > </mx:itemRenderer> > > </mx:DataGridColumn> > > > > --- In flexcoders@yahoogroups.com, "Barry Beattie" > > <barry.beattie@> wrote: > > > > > > thankfully, Brendan Meutzner example helps nicely > > > > > > http://www.visualconcepts.ca/blog/index.cfm/2006/6/22/ComoboBox- > > RendererEditor-for-20 > > > > > > > > > although doing something like this (closer to what I'm after) > > > > > > <mx:DataGridColumn headerText="Type" > > dataField="col3"> > > > <mx:itemRenderer> > > > <mx:Component> > > > <mx:ComboBox > > dataProvider="{colEvalType}"></mx:ComboBox> > > > </mx:Component> > > > </mx:itemRenderer> > > > > > > </mx:DataGridColumn> > > > > > > I get "Access of undefined property colEvalType" which I think is > a > > > scope thing since further down the mxml file it works fine > > > <mx:ComboBox dataProvider="{colEvalType}" y="240"></mx:ComboBox> > > > > > > should this work? > > > > > > 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/