3
votes

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 [email protected]::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

1
Why would you create a JSNI function for the scroll in the first place? This functionality can be done with GWT, and makes it much more easy to maintain. - Hilbrand Bouwkamp

1 Answers

3
votes

Your method is static so there's no this!