Tuesday, August 28, 2012

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

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

On Aug 28, 2012, at 11:39 AM, dave_mcgee <daveomcgee@gmail.com> wrote:

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);

--
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-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment