Friday, March 25, 2016

Re: jsinterop

Thank You.  I forgot about that doc you had written.  Helped me tons!

On Wednesday, March 16, 2016 at 11:26:07 AM UTC-4, Goktug Gokdogan wrote:


On Fri, Mar 4, 2016 at 5:18 AM, Eric Nissan <eric....@gmail.com> wrote:
I tried that also, but

Data[] thing = JsonUtils.safeEval(response.getText()).cast();

does not compile as Data[] is not a JavaScriptObject


Data[] thing =  (Data[])(Object) JsonUtils.safeEval(response.getText());

should work. Also if you choose do define your own Json.parse accessor, you won't need the cast:

@JsMethod(namespace="JSON")
private static native <T> T parse(String text);
 



On Friday, March 4, 2016 at 2:02:34 AM UTC-5, Ümit Seren wrote:

I think you you have to use a normal array: Data[]


Eric Nissan <eric....@gmail.com> schrieb am Fr., 4. März 2016, 04:35:
Thanks a ton!  that worked.
followup, how do I set a List<Data>?
I tried to use JsArray but that requires a JavaScriptObject, which Data is not.

Thanks,
Eric

On Wednesday, March 2, 2016 at 9:36:43 AM UTC-5, Ümit Seren wrote:

This works:

{'somecollection':['String1','String2'],'somestring':'text'}  
@JsType(isNative = true,namespace = JsPackage.GLOBAL,name="Object")  public interface Data {      @JsProperty      String[] getSomecollection();      @JsProperty      String getSomestring();  }    Data data = JsonUtils.safeEval(json).cast();  

On Tuesday, March 1, 2016 at 9:03:03 PM UTC+1, Eric Nissan wrote:

sorry if this has been answered, I just started using jsinterop in gwt 2.8.  What is the recommended way populate data into a jsinterop javascript object from my server.  Assuming I have Json, do we still use OverlayTypes?  or is there a better way to do it?

Always appreciative,
Eric

--
You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/nmBAOX4vcSo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment