javagwtjsnierrai

calling GWT java method in jsni function


I created a JSNI function when the page reach on the bottom it will call some method but i'm having a problem on calling it here is my code

public static native void scroll() /*-{
    var that = this;
    $wnd.$($wnd).on("scroll", function($) {
        var scrollHeight = $wnd.$($doc).height();
        var scrollPosition = $wnd.$($wnd).height() + $wnd.$($wnd).scrollTop();
        if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
            $wnd.$('#loadmore').removeClass('uk-hidden');
            return that.@my.app.client.local.HomePage::query(*)(null);
        }
    });
}-*/;

When I try to call this JSNI I receive an error

Uncaught TypeError: that_0_g$.query_2_g$ is not a function


Solution

  • Your method is static so there's no this!