Skip navigation
Currently Being Moderated

"selected" attribute of Checkbox not working inside a Repeater

Sep 9, 2013 7:53 AM

Tags: #checkbox #selected #repeater

hi guys,

 

I'm trying to create some checkboxes, using Repeater and XML, but they all appear selected, no matter what I put in the XML attribute "selected".
Here's the sample code:

 

<mx:HBox x="72" y="70" width="200" height="200">

                         <mx:Repeater id="repeat_chk" dataProvider="{myXML}">

         <mx:CheckBox id="chks" x="136" y="93" label="{repeat_chk.currentItem.@name}" selected="{Boolean(repeat_chk.currentItem.@selected)}" />

       </mx:Repeater>

</mx:HBox>

 

The labels are showing ok, but checkboxes are always selected.

Anyone has run into this already?

 

thanks,

Tiago

 
Replies
  • Currently Being Moderated
    Sep 9, 2013 3:18 PM   in reply to Tilles80

    See the rules on Boolean() it doesn't do what you expect.  The output of repeat_chk.currentItem.@selected is an XMLList.

     

    I think you need something like Boolean(repeat_chk.currentItem.@selected.toString() == "true")

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points