Assuming ValidatedCheckBox implements IListItemRenderer, <mx:DataGridColumn itemRenderer="ValidatedCheckBox" />
Is ValidatedCheckBox written in MXML or AS? Not that it would affect the answer... Alex Harui Flex SDK Developer Adobe Systems Inc.<http://www.adobe.com/> Blog: http://blogs.adobe.com/aharui From: [email protected] [mailto:[email protected]] On Behalf Of aceoohay Sent: Monday, February 23, 2009 4:22 PM To: [email protected] Subject: [flexcoders] Re: properties and methods of a datagrid from item renderer Alex: How can I use the validatedCheckBox directly, I thought I needed to wrap it in a component to use it as an item renderer in multiple datagrids? Paul --- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Alex Harui <aha...@...> wrote: > > If you removed the HBox, are you still using mx:Component or just the ValidatedCheckBox directly. If you are using it VCB directly, then the following should work: > > private function doHoldRelease(data:Object):void > { > trace(owner.id); > } > > If not, please provide more information on how your code looks now that you've removed the HBox. > > For centering, see: http://blogs.adobe.com/aharui/2007/04/more_thinking_about_item_rende. html > > Alex Harui > Flex SDK Developer > Adobe Systems Inc.<http://www.adobe.com/> > Blog: http://blogs.adobe.com/aharui > > From: [email protected]<mailto:flexcoders%40yahoogroups.com> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>] On Behalf Of aceoohay > Sent: Monday, February 23, 2009 3:22 PM > To: [email protected]<mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Re: properties and methods of a datagrid from item renderer > > > Alex: > > I removed the hbox (I would like to figure out how to center the > checkbox, but that is for a different thread). > > When I execute the trace statement, I get the name of the module > that contains the panel that contains the tab navigatior that > contains the canvas that contains the datagrid. What I need is the > datagrid itself. > > Any other ideas? > > Paul > > --- In > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com>, Alex Harui <aharui@> wrote: > > > > Probably: > > > > private function doHoldRelease(data:Object):void > > { > > trace(document.owner.id); > > } > > > > BTW, Using an HBox to center a checkbox is "heavy" and prevents > you from directly using "owner". > > > > Alex Harui > > Flex SDK Developer > > Adobe Systems Inc.<http://www.adobe.com/> > > Blog: http://blogs.adobe.com/aharui > > > > From: > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com> > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com>] On Behalf Of aceoohay > > Sent: Monday, February 23, 2009 8:18 AM > > To: > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com> > > Subject: [flexcoders] Re: properties and methods of a datagrid > from item renderer > > > > > > Alex: > > > > Thanks for the reply. What I am doing is not quite an inline > > component. I have 1 component in my mxml file that is referenced by > > 3 different datagrids like this; > > > > <mx:Component id="cbHoldRelease"> > > <mx:HBox textAlign="center"> > > > > <mx:Script> > > <![CDATA[ > > private function doHoldRelease(data:Object):void > > { > > trace('What datagrid called me?'); > > } > > > > ]]> > > </mx:Script> > > <inp:ValidatedCheckBox checkedValue="R" uncheckedValue="H" > > click="doHoldRelease(data);"/> > > </mx:HBox> > > </mx:Component> > > > > <mx:DataGrid width="887" height="20" id="dg1" y="28" x="5> > > <mx:columns> > > <mx:DataGridColumn width="27" headerText="Rel" > > itemRenderer="{cbHoldRelease}" > > rendererIsEditor="true" > > editorDataField="selected" paddingLeft="1"/> > > </mx:columns> > > > > </mx:DataGrid> > > > > <mx:DataGrid width="887" height="20" id="dg2" y="48" x="5"> > > <mx:columns> > > <mx:DataGridColumn width="27" headerText="Rel" > > itemRenderer="{cbHoldRelease}" > > rendererIsEditor="true" > > editorDataField="selected" paddingLeft="1"/> > > </mx:columns> > > > > </mx:DataGrid> > > > > <mx:DataGrid width="887" height="20" id="dg3" y="68" x="5"> > > <mx:columns> > > <mx:DataGridColumn width="27" headerText="Rel" > > itemRenderer="{cbHoldRelease}" > > rendererIsEditor="true" > > editorDataField="selected" paddingLeft="1"/> > > </mx:columns> > > > > </mx:DataGrid> > > > > The trace statement needs to display dg1, dg2, dg3 depending on > > where the user was when they clicked the button. Actually I need to > > pass the dg(1,2,3).dataprovider, and the the selectedIndex. > > > > BTW ValidatedCheckBox is a data aware checkbox component we wrote. > > > > --- In > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com><mailto:flexcoders% > 40yahoogroups.com>, Alex Harui <aharui@> wrote: > > > > > > <mx:DataGrid id="dg" > > > <mx:columns> > > > <mx:DataGridColumn> > > > <mx:itemRenderer> > > > > > <mx:Component> > > > > > From in here, outerDocument.dg is the DataGrid for this > > inline renderer > > > > > > You can also use "owner" in most cases > > > > > > Alex Harui > > > Flex SDK Developer > > > Adobe Systems Inc.<http://www.adobe.com/> > > > Blog: http://blogs.adobe.com/aharui > > > > > > From: > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com><mailto:flexcoders% > 40yahoogroups.com> > > [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com><mailto:flexcoders% > 40yahoogroups.com>] On Behalf Of aceoohay > > > Sent: Sunday, February 22, 2009 1:08 PM > > > To: > > > [email protected]<mailto:flexcoders%40yahoogroups.com><mailto:flexcoders% 40yahoogroups.com><mailto:flexcoders% > 40yahoogroups.com> > > > Subject: [flexcoders] properties and methods of a datagrid from > > item renderer > > > > > > > > > How do you access the properties and methods of a datagrid from > an > > an > > > item renderer/inline component? > > > > > > I have a component that is called from multiple datagrids. In > > certain > > > cases I need to call a routine that manipulates the datagrid, > > whichever > > > one has the item renderer in it. > > > > > > I need to access the selectedIndex, and the dataprovider to pass > > to the > > > outerDocument routine that I call. How can you reference grid > from > > > whence you came? > > > > > > Paul > > > > > >

