Hi Alex,

Thank you for the reply.
After I dig further the forum, I found a thread that actually already 
tackle this problem.

Here's the thread:
http://tech.groups.yahoo.com/group/flexcoders/message/69360

Find the reply by Doug McCune.
He got the solution in his blog.

Doug, you are the man!

--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> You could just keep setting selectedIndices
> 
>  
> 
> ________________________________
> 
> From: [email protected] 
[mailto:[EMAIL PROTECTED] On
> Behalf Of handitan
> Sent: Friday, June 01, 2007 3:06 PM
> To: [email protected]
> 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