GWT 2.4.0 - DataGrid - Differentiating between single click and double clicks on rows

699 views
Skip to first unread message

dave_mcgee

unread,
Aug 28, 2012, 11:39:49 AM8/28/12
to google-we...@googlegroups.com
Hi there,

I am currently picking up on a row selection (single click) in a DataGrid using NoSelectionModel (As seen below). This works fine and I perform a certain action based on this selection. However, I also want to pick up on when a user double clicks a row in this data grid. Does anyone have any advice? Thanks! 

final NoSelectionModel<MyObjectRecord> selectionModel = new NoSelectionModel<MyObjectRecord>();
selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) { 
final MyObjectRecord myObjectRecord = selectionModel.getLastSelectedObject();
        // Do stuff with myObjectRecord 
}
});

this.setSelectionModel(selectionModel);

Juan Pablo Gardella

unread,
Aug 28, 2012, 11:42:27 AM8/28/12
to google-we...@googlegroups.com
See  https://groups.google.com/forum/?hl=tr&fromgroups=#!topic/google-web-toolkit/j_HF85Mqhnk 

2012/8/28 dave_mcgee <daveo...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/mKxVnb-JzJ0J.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Kara Rawsonkara

unread,
Aug 28, 2012, 12:28:40 PM8/28/12
to google-we...@googlegroups.com, google-we...@googlegroups.com
sink a mousedown event and use a static double click bool flag when u see a click check flag if its up the its a double click and reset the flag if not then is a single click. add a timer too that will reset the flag after a delay of like 100ms or something. 

kara

Sent from my iPhone
--
Reply all
Reply to author
Forward
0 new messages