Hii Tracy, Here is my repeater(am using 3 repeaters, to have three columns to prevent having a scrollbar). Suggest me if there is any better way to do this, although it's not the issue at the moment. I have highlighted the problematic code in handler method below. Code for repeater: <mx:HBox id="hb" height="100%" width="100%"> <mx:VBox id="vb1" height="100%" width="200"> <mx:Repeater id="r1" dataProvider="{myData}" startingIndex="1" count="20" repeat="validateChecks(event)"> <mx:CheckBox id="chkFirstColumn" label="{r1.currentItem.keyword_value_id}" data="{r1.currentItem}"/> </mx:Repeater> </mx:VBox> <mx:VBox id="vb2" height="100%" width="200"> <mx:Repeater id="r2" dataProvider="{myData}" startingIndex="21" count="20" repeat="validateChecks(event)"> <mx:CheckBox id="chkSecondColumn" label="{r2.currentItem.keyword_value_id}" data="{r1.currentItem}"/> </mx:Repeater> </mx:VBox> <mx:VBox id="vb3" height="100%" width="200"> <mx:Repeater id="r3" dataProvider="{myData}" startingIndex="41" count="20" repeat="validateChecks(event)"> <mx:CheckBox id="chkThirdColumn" label="{r3.currentItem.keyword_value_id}" data="{r1.currentItem}"/> </mx:Repeater> </mx:VBox> </mx:HBox>
Code for Handler: private function validateChecks(e:Event):void{ if(e.currentTarget.id == "r1" && existingData.length() > 0){ for(var j:uint = 0; j < existingData.length(); j++){ if(e.currentTarget.currentItem.keyword_value_key == existingData[j].keyword_value_key){ e.currentTarget.currentItem.selected = true; //Problem is here. It's not working.I want to refer the checkbox inside repeater here. } } } } Tracy Spratt wrote: > > If your repeated component has an id="myId", you can refer to individual > instances it by doing: > > myId[n]. where n is the index of the repeater item. > > > > But from your description, I do not think this is what you want. If > you want to set the check box states based on data in the dataProvider > item, then you need to use currentItem. > > > > Perhaps you should post a bit of the code. > > > > Tracy > > > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of Manu Dhanda > Sent: Wednesday, October 24, 2007 10:56 PM > To: flexcoders@yahoogroups.com > Subject: RE: Re[flexcoders] peater > > > > > Hi Tracy > > As I said, I need to check a few checkboxes based on the values from my > dataprovider, not all checkboxes. So, definitely, I need to refer each > and > every checkbox inside the repeater. > > Or simply, say I have to do this 'selected' = true/false in a > eventhandler > method. > > Now, how should I refer that checkbox inside a repeater?? > Thanks, > Manu. > > Tracy Spratt wrote: >> >> You don't need a result handler for this. Just do: >> >> <mx:CheckBox ... selected="{r1.currentItem.selected}" >> >> >> >> Tracy >> >> >> >> ________________________________ >> >> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> > ] On >> Behalf Of Manu Dhanda >> Sent: Tuesday, October 23, 2007 4:07 AM >> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> >> Subject: Re[flexcoders] peater >> >> >> >> >> Hii Guyz, >> >> I have a Repeater(r1) and a checkbox(ch1) inside it. >> >> I am passing a dataprovider dynamically to the repeater and based on > the >> values, I want to select a few checkboxes. >> >> In the repeat event, e.currentTarget is referring to r1. >> Now how can I refer the checkbox(ch1) inside it?? >> >> So, that I could do something: >> e.currentTarget.currentItem.selected = true; >> >> Please guide me. >> Thanks. >> -- >> View this message in context: >> http://www.nabble.com/Repeater-tf4675803.html#a13359221 > <http://www.nabble.com/Repeater-tf4675803.html#a13359221> >> <http://www.nabble.com/Repeater-tf4675803.html#a13359221 > <http://www.nabble.com/Repeater-tf4675803.html#a13359221> > >> Sent from the FlexCoders mailing list archive at Nabble.com. >> >> >> >> >> > > -- > View this message in context: > http://www.nabble.com/Repeater-tf4675803.html#a13399388 > <http://www.nabble.com/Repeater-tf4675803.html#a13399388> > Sent from the FlexCoders mailing list archive at Nabble.com. > > > > > -- View this message in context: http://www.nabble.com/Repeater-tf4675803.html#a13482739 Sent from the FlexCoders mailing list archive at Nabble.com.