the object has properties but when you concatenate a string with your object in the line
"We can't see the obj's properties, only:" + obj
you are essentially converting obj to a string through obj.toString() so your
native method does not receives the object obj but a string.
try this passing just obj to printObj.
A.
On Fri, May 15, 2015 at 8:57 AM Alex W <alexwhite3000@gmail.com> wrote:
-- Wouldn't the object have a bunch of JSON properties then?
On Friday, May 15, 2015 at 4:47:39 PM UTC+10, Alberto Mancini wrote:Hi,
you are converting obj to a string before calling printObj: "We can't see the obj's properties, only:" + objHope this helps.Alberto.--On Fri, May 15, 2015 at 7:52 AM Alex W <alexwh...@gmail.com> wrote:We are usingJSInterop in GWT2.8. In one of our RPCs we have some code like this that passes our java object to JS:
onSuccess(List<MyObject> objs) {
for (MyObject obj: objs) {
jsCode.printObj("We can't see the obj's properties, only:" + obj);
}
}
The definition of jsCode looks like this:
ns.printObj = function(obj) {
console.log(JSON.stringify(obj));
}
In the console we get back:
We can't see the obj's properties, only:our.ns.type.MyObject@16
The value object has been annotated as @JsType. Anything else we need to do?
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" 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 http://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 "Google Web Toolkit" 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 http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment