Thanks buddy, will check the file :-) On 2/19/10, manish sankhe <sankhe.man...@gmail.com> wrote: > hey dude... sorry for late reply ..i have attached sample app that i have > created based on your requirements. > > create main application with name "DataGridIssue.mxml" > and in same package create component "Comp.mxml" this component will be > 'itemRenderer" of advancedatagrid which is placed in > DataGridIssue.mxml > > > 1) code for DataGridIssue.mxml > __________________________________________________________________________________________________ > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" > creationComplete="init()"> > <mx:Script> > <![CDATA[ > import flash.sampler.NewObjectSample; > import mx.collections.ArrayCollection; > [Bindable] private var arr:ArrayCollection; > > public var dict:Dictionary= new Dictionary(); > private function init():void > { > arr= new ArrayCollection( > [{}, > {}, > {}]); > } > > private function searchItem(eve:Event):void > { > var key:String= (eve.target as Button).label; > (dict[key] as Comp).lb.text= "yes!!! I have done it dude"; > } > ]]> > </mx:Script> > <mx:AdvancedDataGrid id="ad" itemRenderer="Comp" dataProvider="{arr}"> > <mx:columns> > <mx:AdvancedDataGridColumn id="col1"/> > <mx:AdvancedDataGridColumn id="col2"/> > <mx:AdvancedDataGridColumn id="col3"/> > </mx:columns> > </mx:AdvancedDataGrid> > <mx:Button id="btn" click="searchItem(event)" x="10" y="275" > label="00"/> > <mx:Button id="btn0" click="searchItem(event)" x="106" y="305" > label="21"/> > <mx:Button id="btn1" click="searchItem(event)" x="58" y="305" > label="11"/> > <mx:Button id="btn2" click="searchItem(event)" x="10" y="305" > label="01"/> > <mx:Button id="btn3" click="searchItem(event)" x="106" y="275" > label="20"/> > <mx:Button id="btn4" click="searchItem(event)" x="10" y="335" > label="02"/> > <mx:Button id="btn6" click="searchItem(event)" x="106" y="335" > label="22"/> > <mx:Button id="btn7" click="searchItem(event)" x="58" y="335" > label="12"/> > <mx:Button id="btn5" click="searchItem(event)" x="58" y="275" > label="10"/> > </mx:Application> > ___________________________________________________________________________________________ > 2) code for "Comp.mxml" > > ____________________________________________________________________________________________ > <?xml version="1.0" encoding="utf-8"?> > <mx:Canvas creationComplete="addInDictionary()" > implements="mx.controls.listClasses.IDropInListItemRenderer" xmlns:mx=" > http://www.adobe.com/2006/mxml" width="118" height="30" > horizontalScrollPolicy="off" verticalScrollPolicy="off"> > <mx:Script> > <![CDATA[ > import mx.controls.DataGrid; > import mx.controls.listClasses.ListBase; > import mx.controls.listClasses.BaseListData; > > > public var colIndex:Number= new Number(); > public var rowIndex:Number = new Number(); > > private var _listData:BaseListData; > > override public function set data(value:Object):void > { > if(_listData != null) > { > colIndex= _listData.columnIndex; > rowIndex= _listData.rowIndex; > } > } > > // Define the getter method. > public function get listData():BaseListData > { > return _listData; > } > > // Define the setter method, > public function set listData(value:BaseListData):void > { > _listData = value; > } > > private function addInDictionary():void > { > var key:String= colIndex.toString()+rowIndex.toString(); > lb.text= key; > (this.parentApplication as DataGridIssue).dict[key]= this; > } > > ]]> > </mx:Script> > <mx:Label x="10" y="7" id="lb" width="98"/> > </mx:Canvas> > ______________________________________________________________________________________________ > > hope u can easily understand the code once u go through it > here is short explanation of what i have donehere in this code:- > > i am storing reference of itemRenderer component in Dictionary object and > whose key value is based on column and row index of each cell of data-grid > > so when i click on button, i m passing index "00" to this dictionary object > it returns me the reference of rendered component which is at location 00 in > data-grid. > > hope u was expecting this only....... :) > > cheers.... :) > > > > On Thu, Feb 18, 2010 at 12:34 PM, Shobita <s.shob...@gmail.com> wrote: > >> Create a custom DG and add this method in it. You can get the >> itemrenderer of the required cell using this method. >> >> public function indexToCellItemRenderer(rowIndex:int, >> columnIndex:int):IListItemRenderer >> { >> var firstItemIndex:int = verticalScrollPosition - >> offscreenExtraRowsTop; >> >> if (rowIndex < firstItemIndex || >> rowIndex >= firstItemIndex + listItems.length) >> { >> return null; >> } >> >> return listItems[rowIndex - >> firstItemIndex][columnIndex]; >> } >> >> On Feb 17, 9:01 pm, Ravi M <flashr...@gmail.com> wrote: >> > You can use labelfunction or Style function and write some condition to >> > change property. >> > >> > Ravi >> > >> > >> > >> > On Wed, Feb 17, 2010 at 5:26 PM, Arindam Dhar <arin.d...@gmail.com> >> wrote: >> > > Hi, >> > >> > > I have a editable AdvancedDataGrid, with x rows and y columns. Each >> cell >> > > has itemrenderer. >> > >> > > Now, suppose at some event,say, button click , i want to target the >> > > itemrenderer object in ,for ex., row 1 , col 2 and change some >> > > property >> of >> > > the same, how do I address the same? >> > >> > > I could find out the columnIndex and rowIndex only when item is >> > > edited. >> > >> > > Appreciate some quick help or suggestion. >> > >> > > regards, >> > >> > > Arindam >> > >> > > -- >> > > You received this message because you are subscribed to the Google >> Groups >> > > "Flex India Community" group. >> > > To post to this group, send email to flex_in...@googlegroups.com. >> > > To unsubscribe from this group, send email to >> > > flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> >> <flex_india%2bunsubscr...@googlegrou ps.com> >> > > . >> > > For more options, visit this group at >> > >http://groups.google.com/group/flex_india?hl=en. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Flex India Community" group. >> To post to this group, send email to flex_in...@googlegroups.com. >> To unsubscribe from this group, send email to >> flex_india+unsubscr...@googlegroups.com<flex_india%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/flex_india?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Flex India Community" group. > To post to this group, send email to flex_in...@googlegroups.com. > To unsubscribe from this group, send email to > flex_india+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/flex_india?hl=en. > >
-- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.