You could just keep setting selectedIndices

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of handitan
Sent: Friday, June 01, 2007 3:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Checkbox needs to have the same behavior like
'ctrlkey+mouse click' in datagrid

 

Hi,

I have a datagrid that allows me to do select multiple rows by holding 
down ctrlkey and clicking each row, and it also allows me to drag those 
rows to a tree.

Now, I have been told to replicate this same behavior but with checkbox.

So I already have checkbox as part of the datagridColumn but I got 
confused on how to solve this after my first solution failed.

My solution was I am dispatching the ctrkey event to dataGrid and let 
the dataGrid does it magic in saving the selected row as I mouseclick 
the row. 

public function chkBoxHandler(event:Event):void
{
myGrid.dispatchEvent(new KeyboardEvent
(KeyboardEvent.KEY_DOWN,true,false,0,17,1,true));
}

<mx:DataGrid id="myGrid" dataProvider="{dataBucket.datas}"
height="100%" 
width="100%"
dragEnabled="true"
dragEnter="onDragEnter(event)" 
dragOver="onDragOver(event)" 
dragDrop="onDragDrop(event)"
allowMultipleSelection="true"
doubleClickEnabled="true"
itemDoubleClick="itemDoubleClickEvt(event)"
itemClick="itemClickEvt(event)"
>
<mx:columns>
<mx:DataGridColumn id="checkBox" minWidth="20" width="20" 
sortable="false" >
<mx:itemRenderer>
<mx:Component>
<mx:HBox>
<mx:CheckBox labelPlacement="bottom" height="18" 
click="outerDocument.chkBoxHandler(event)"/> 
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</DataGridColumn>
... and there are multiple other DataGridColumns

Any ideas?




 

Reply via email to