Plenty of ways to accomplish this; one way is to provide a click
handler for your checkbox, and then set a property of the
corresponding dataprovider item that you can then examine from
another function. Cell renderers automatically get passed
references to some handy objects and functions that you can use.
var listOwner: MovieClip; // the reference to the list
var getCellIndex: Function; // the function we receive
function onCheckboxClicked(event) {
listOwner.dataProvider.getItemAt(
getCellIndex().itemIndex).isCheckboxSelected =
event.target.selected;
}
Just add click="onCheckboxClicked(event)" to your mx:CheckBox, and
any function can then loop through your dataprovider's items
examining the isCheckboxSelected property to determine the state of
the checkbox.
Doug
--- In [email protected], "digital_eyezed"
<[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have a simple cellrenderer in a List which contains a checkbox.
>
> I want to check through the list to see which items are checked.
>
> Here is the cellrenderer:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:HBox styleName="wizardContainer" horizontalAlign="left"
> xmlns:mx="http://www.macromedia.com/2003/mxml" width="100%"
> height="100%">
> <mx:Script>
> <![CDATA[
> var theLabel;
> var theData;
> function setValue(str:String, item:Object, sel:Boolean){
> theLabel = String(item.label);
> theData = Number(item.data);
> }
> ]]>
> </mx:Script>
> <mx:Spacer width="5"/>
> <mx:CheckBox width="20" id="siteSelected" selected="false"/>
> <mx:Text width="100%" text="{theLabel}"
> styleName="cellRendererText"/>
> </mx:HBox>
>
> Here is the list:
>
> <mx:List cellRenderer="components.WizardCell" id="list2"
> width="100%" height="100%"
> dataProvider="{service.getMethod.result}"/>
>
> There is a Submit button below this which when clicked I want to
> check through the list to see which items have been checked. Each
> object in the list has a data and label attribute from the
> dataProvider, ideally I would like to get an array of the data
> attributes of those checked.
>
> Cheers,
>
> Iain
>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/