3

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

Cœur
  • 37,241
  • 25
  • 195
  • 267
julsbrhm
  • 103
  • 6
  • 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 Sep 15 '16 at 18:15

1 Answers1

3

Your method is static so there's no this!

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164