Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    JSOHelper.eval return values

    I am trying to learn how to get data returned from JSOHelper.eval(). I have the following code:
    Code:
    JavaScriptObject jso = JSOHelper.eval("( window.location.href.indexOf('locale=') > -1)");
    But I get a JavaScript error window saying:
    Unexpected error has occurred.Something other than a Java object was returned from JSNI method '@com.smartgwt.client.util.JSOHelper::eval(Ljava/lang/String;)': JS value of type boolean, expected java.lang.Object

    I know it's a boolean.... how do I get it back into my smartgwt code to use?
    Last edited by bootz15; 21 Jun 2011, 06:18.

    #2
    You should be using Window.Location.getHref() for this.

    Comment


      #3
      Originally posted by smartgwt.dev
      You should be using Window.Location.getHref() for this.
      Thanks for the good suggestion. Just to clarify, I found that this should be the google.gwt Window class:
      com.google.gwt.user.client.Window
      not:
      com.smartgwt.client.widgets.Window

      However I'm still not sure how to return a value from JSOHelper.eval()... very hard to find documentation on this topic.

      Comment


        #4
        If you're looking for the general ability to have JavaScript code in your app, that's a core function of GwT, Google "GWT JSNI".

        Comment

        Working...
        X