gwterraigquery

How to call GWT client code from within a GQuery event handler?


I'm learning GQuery. It seems cool, but also a little confusing.

I have the following GWT client code. The selected item fades out, nicely. But the delete method never gets called. There is no error. It's very odd.

Is it even possible to call non-GQuery functions from inside a GQuery method?

delete.addClickHandler( new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
        $(myIndicator).fadeOut(500, new Function(){
            @Override
            public void f() {                       
                super.f();
                delete();
            }                   
        });                 

    }
});

And the delete method is:

private void delete() {
    removeFromParent();
    ruleDeleteRequestEvent.fire(new RuleDeleteRequestEvent(ruleBinder.getModel()));
}    

Solution

  • Do not call super.f(), if so the default implementation of Function.f() will throw an Exception preventing the next line be executed (take a look to the source code) .