Didn't look for other issues. Should be ok though
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of j_lentzz Sent: Monday, November 12, 2007 2:43 PM To: [email protected] Subject: [flexcoders] Re: Custom itemRenderer using Label Question Thanks. That's a good idea. Anything else seem funny? John --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > I would store the CB's DP somewhere so you can get at it w/o creating an > editor. > > > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of j_lentzz > Sent: Monday, November 12, 2007 6:56 AM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Custom itemRenderer using Label Question > > > > Hi, > > I'm using the following code to set the data of an extended Label > being used as an itemRenderer in a datagrid. The editor for the cell > is a combobox. What I'm doing is taking the data value sent down for > that cell (a number), looking it up in the dataprovider of the > combobox and displaying the corresponding label in my custom Label > widget. What I'm wondering is if this is the best way to do it. In > particular, the part that concerns me is that I'm creating an instance > of the combobox editor to get the dataprovider collection to search. > Any thoughts would be greatly appreciated. Thanks, John > > override public function set data(value:Object):void { > super.data = value; > > var cbr:ComboBoxRenderer; // will contain renderer for this cell > var dg:DataGrid; // reference to grid containing this cell > var dp:ArrayCollection; // dataProvider of selected cell's comboBox > > if (listData != null) { > dg = DataGrid(listData.owner); > > cbr = dg.columns[listData.columnIndex].itemEditor.newInstance(); > dp = cbr.dataProvider as ArrayCollection; > // now iterate through dp to find a matching data value, when > found put its label in the Label widget > var dpLen:int = dp.length; > for (var j:int=0; j<dpLen; j++) { > if (dp.getItemAt(j).data == > data[DataGridListData(listData).dataField]) { // found match > this.text = dp.getItemAt(j).label; // + " " + dp.getItemAt(j).data; > trace('found LabelWithDownArrow'); > return; > } > } > // not found, so show comboBox prompt > this.text = cbr.prompt; > } > } >

