currentItem only exists while the repeater is creating its elements and
not when the binding fires.  Your solution is fine if it works for you.
There are other options.

 

Always with repeater, for anything other than a very simple,
non-interactive component, I advise creating a custom component and
repeating that.  Pass into that component a reference to the entire
currentItem.  You can now code normally, reference internal ids,
dispatch events, provide a public data property that references the
item, and avoid getRepeaterItem().  This would solve your issue, since
your ternary expession would be referencing a local variable.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Fotis Chatzinikos
Sent: Thursday, November 27, 2008 10:03 AM
To: [email protected]
Subject: Re: [flexcoders] repeater problems and localization

 

Made it working by removing the reference to localizedMessages and
inserting the localized messages inside the dataprovider for the
repeater... Is that the proper way to do it?

On Thu, Nov 27, 2008 at 3:16 PM, fotis.chatzinikos
<[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >
wrote:

Hi, i am using a repeater to draw dynamic grid rows with labels and
togglebutton bars. The following works initially, but when the
localizedMessages object is updated and a binding event fires the
repeater breaks with the following error:

Error: Repeater is not executing.
at mx.core::Repeater/get currentItem()
at <anonymous>()

I have searched and found some staff on getRepeaterItem(), but if i
use it inside the repeater instead of currentItem it does not work
even the first time...

Any ideas?

Repeater mxml: 

<mx:Repeater id="notificationsRepeater"
dataProvider="{notificationsData}">
<mx:GridRow width="100%" height="30">
<mx:GridItem width="100%" height="100%" verticalAlign="middle">
<mx:Label
text="{localizedMessages[String(notificationsRepeater.currentItem.name
<http://notificationsRepeater.currentItem.name> )]}"/>
</mx:GridItem>
<mx:GridItem width="100%" height="100%" horizontalAlign="center"
verticalAlign="middle" colSpan="2">
<mx:ToggleButtonBar dataProvider="[Yes,No]"
selectedIndex="{notificationsRepeater.currentItem.value==true?0:1}"
itemClick="notificationsChanged()">
</mx:ToggleButtonBar>
</mx:GridItem>
</mx:GridRow>
</mx:Repeater>




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> , 

 

Reply via email to