Called from Java GWT code JavaScript function of JS file
•
Java
I have a button in Java GWT code I have a JavaScript file in the script folder I want to access the function of the JS file on the button button
So how do I call this method from the Java GWT code (click event in Button)?
Anyone can tell me the code or how to access JS file functions
Thank you in advance
Solution
Because your code should not rely on the GWT linker (and how it loads the code), you need to prefix the call with the correct window object Reapp doesn't take this into account So it actually needs to be:
public static native void onMyButtonClick() /*-{ $wnd.myJSfunction(); }-*/;
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码