Hi, Chris.

The simplest change to your file to make it do what you ask (i.e., click the
9th item and it unchecks the 3rd and 4th checkbox), is to put

id="cb"

on the CheckBox tag and change its click handler to

click="cb[0][2].selected=false; cb[0][3].selected=false"

This isn't very elegant, as it directly references the third and fourth
checkboxes rather than manipulating the underlying dataProvider and having
the checkboxes indirectly update, but -- hey -- you're in a hurry to get a
demo working.

The key thing here is that repeated instances of an object are addressed
using array notation. So the first five checkboxes are cb[0][0] through
cb[0][4] and the second five are cb[1][0] through cb[1][4].

Your code with my modification is below.

I look forward to a seeing a purchase order soon from you. You can also send
an MP3 of you squealing. :)

- Gordon


<?xml version="1.0" encoding="utf-8"?>
<mx:Application width="100%" height="100%" 

xmlns:mx="http://www.macromedia.com/2003/mxml"; xmlns="*">

<mx:Model id="optionModel">
<options category="Category One">
<option selectionState="false" number="C1 - option
one"/>
<option selectionState="true" number="C1 - option
two"/>
<option selectionState="true" number="C1 - option
three"/>
<option selectionState="true" number="C1 - option
four"/>
<option selectionState="true" number="C1 - option
five"/>
</options>
<options category="Category Two">
<option selectionState="true" number="option one"/>
<option selectionState="true" number="option two"/>
<option selectionState="true" number="option
three"/>
<option selectionState="true" number="option four"/>
<option selectionState="true" number="option five"/>
</options>
</mx:Model>

<mx:VBox id="formBox" width="400" height="400" marginTop="5"
marginLeft="5" backgroundColor="#FFFFFF">

<!-- <mx:DataGrid dataProvider="{optionsArray}"/> -->
<mx:Repeater id="rOptionCats"
dataProvider="{optionModel.options}">
<mx:Label text="{rOptionCats.currentItem.category}"
fontSize="14" fontWeight="bold"/>
<mx:Repeater id="rOptions"
dataProvider="{rOptionCats.currentItem.option}">
<mx:HBox marginLeft="15">
<mx:CheckBox id="cb" width="5%" 

selected="{rOptions.currentItem.selectionState}" 

click="cb[0][2].selected=false; cb[0][3].selected=false"/>
<mx:Label
text="{rOptions.currentItem.number}"/>
</mx:HBox>
</mx:Repeater>
</mx:Repeater>

</mx:VBox>

<!-- <Inspect/> -->

</mx:Application>

-----Original Message-----
From: Chris Phillips [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 28, 2005 8:14 PM
To: [email protected]
Subject: Re: [flexcoders] Repeater Trouble STILL NEED HELP



Matt,

What I have is a display that has nested repeaters that create a form. The
form is bound to an array of options. But the options are interconnected.
So, when someone clicks one I might need to unselect others. But if I do
this by completely refreshing the dataprovider, I get this half second of
blank screen while it redraws. I want to be able to update the checkboxes
individually through the dataprovider or through some other voodoo so that
my screen will not go blank. My bosses big pitch to everyone is "Hey we can
have a more desktop app like tool here. We don't have to have these ugly
html total screen refreshes..."

If you can show me an example with the file that I sent where you click the
9th item and it unchecks the 3rd and 4th checkbox, I will squeel like a
little girl. And we'll buy the Flex server.


On Fri, 28 Jan 2005 16:05:43 -0800, Matt Chotin <[EMAIL PROTECTED]>
wrote:
> 
> 
> 
> You're just trying to update the value in the model right?
> 
> 


-- 
Chris Phillips
www.dealerpeak.com
Senior Application Developer



Yahoo! Groups Links








Reply via email to