开发者

Add a DoubleClickHandler to a FixedWidthGrid

开发者 https://www.devze.com 2022-12-31 10:47 出处:网络
so I got a FixedWidthGrid table which is made from a pagingtable FixedWidthGrid dataTable =x.getDataTable();

so I got a FixedWidthGrid table which is made from a pagingtable

FixedWidthGrid dataTable =  x.getDataTable();

I could add alot of handlers to the dataTables rows开发者_如何学Python like selected or sort policies.

but I cant add a double click handler ... any idea's ?!

thank you

I do have a class which I made to try to add a double click handler but it didn't work.

class:

    public class DoubleClickTable extends FixedWidthGrid implements HasDoubleClickHandlers {
    public DoubleClickTable() {
        super();
    }

    public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
        return addDomHandler(handler, DoubleClickEvent.getType());
    }

}

Thank you so much for your help.


Here is the way I'd implement a double click handler :

  • Create a time attribute to the class
  • In the ClickHandler method, fill a variable with the current time.
  • Compare the variable with the time attribute of the class (var - attr) and if the result is equal or smaller than one second, execute the method that handle double clicks.

This should do the trick. If you want more precision, don't hesitate to ask.

0

精彩评论

暂无评论...
验证码 换一张
取 消