Many thanks Scott,
I had forgotten the MVC rule "work on the data model".
Well, my grid is bound to an XML stored in mySource:XMLListCollection, so
your code becomes:
private function selectAll(selected:Boolean):void
{
for each(var item:XML in mySource)
{
[EMAIL PROTECTED] = selected;
}
myGrid.invalidateList();
}
and it works pretty well.
The problem is that invalidateList() does not work, i.e. the grid is not
refreshed.
What could the problem be ?
Scott Melby-3 wrote:
>
> You should be able to just set the property of the objects in your data
> provider that the checkboxes are rendering. For example, if your grid
> is bound to an array of objects of type MyClass that are stored in
> mySourceArray:Array then this would do it.
>
> private function selectAll(selected:Boolean):void
> {
> for each(var item:MyClass in mySourceArray)
> {
> item.selected = selected;
> }
>
> myGrid.invalidateList();
> }
>
>
>
> hth
> Scott
>
> Scott Melby
> Founder, Fast Lane Software LLC
> http://www.fastlanesw.com
> http://blog.fastlanesw.com
>
>
>
> p_repetti wrote:
>> Hello
>>
>> I have created a DataGrid component whose last column is rendered/edited
>> with a checkbox. This checks whether the row data will be sent to the
>> server
>> or not.
>> Rather than forcing the user to check all of the rows manually, I have a
>> "Select All" button which commands the selection of all the checkboxes in
>> that column.
>> My problem is that I can't write the code to implement the selection. It
>> is
>> AS code most likely, but I could not find an example going through
>> docs/forums/whatever.
>> How do I loop over the DataGridColumn object to get the CheckBox
>> instances ?
>>
>> Can anyone point me to useful examples/references ?
>>
>> Thanks
>>
>
>
>
--
View this message in context:
http://www.nabble.com/Select-all-checkboxes-in-datagrid-with-a-single-click-tp16196734p16198564.html
Sent from the FlexCoders mailing list archive at Nabble.com.