0

hi all i am trying to call a native Js function called test i wrote in the HTML file in the smartGWT project but it sayes test is not a function

the native java script code in the smartGWT class :

public static native void  callTest()/*-{
        window.test();

}-*/;

the java script function in the HTMLfile :

 <script  type="text/javascript">   
    function test(){
        window.alert("test");
    }
    </script>

and i also added :

<script src="org.example.yourcode.Spiffy.nocache.js"></script>

but as i mantaind it sayes test is not a function so dos any one have any idea or any one can provide any help please ?
thanx

and when i add $window.test() instead window.test() i get the following message ?

enter image description here
and when i use $wnd.test(); i had the following error :

Error when using $wnd.test()

3 Answers 3

1

just try adding '$' in front of window.test(). i.e. $window.test() and see.

Sign up to request clarification or add additional context in comments.

2 Comments

try to run application in different browser.
i did and i had the same problem
1

Try using $wnd instead of window.

1 Comment

i did and i had the the same result :(
0

GWT JavaScript is loaded in an iframe in the host page, so "window" and "document" in your JavaScript will refer to the iframe. GWT aliases the host page "window" and "document" via $wnd and $doc.

Please read all of this section: http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html

2 Comments

i did but it says null i added the exception to the question above
Did you actually look at the log in the DevMode console? Like the error message says? Post the exception that's there.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.