0

What I want is to call this code

public native void eventClickHandler( String id) /*-{
  $wnd.jQuery('#' + id).bind('jqplotDataClick',function(ev, seriesIndex, pointIndex, data) {
    [email protected]::onClick(Ljava/lang/String;Ljava/lang/String;)(seriesIndex, pointIndex);
  });
}-*/;

Here the onClick method is a normal java method and I'm using GWT and JSNI interface for this. Thanks in advance!..

3

1 Answer 1

1

Have you used jQuery before? this has particular meaning inside a function passed to jQuery. Even in JSNI, while it is in a Java file, it won't behave like a Java this, but like a JavaScript this.

Try this instead:

public native void eventClickHandler( String id) /*-{
  var origThis = this;
  $wnd.jQuery('#' + id).bind('jqplotDataClick',function(ev, seriesIndex, pointIndex, data) {
    [email protected]::onClick(Ljava/lang/String;Ljava/lang/String;)(seriesIndex, pointIndex);
  });
}-*/;
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply but it seems that its still not working, have to find out a way to refer methods inside a jquery function.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.