I tried that, it gave me the same result, but your post gave me an idea. I 
set printObj up to assign a variable with it's data, so the last element in 
the list would get it.

Inside 
ns.printObj = function(data) {
   ns.foo = data;
}

Then I typed ns.foo into chrome's dev console so I could introspect the 
object that way. It turns out that the data is there, but it's all mangled 
with funny symbols like
kRg_g$ {  mySymbol_1_g$  } etc. Can anyone on the GWT team weigh in and 
tell me how to unmangle it, such that I can write my views in JS and my 
model/controller in java? 

On a side note, it would be really nice if there was a nice no-brainer way 
of serializing/deserializing between JSON and Java Objects exposed to gwt 
users. This has always been a huge feature hole in gwt imo.

Thanks
Alex


On Friday, May 15, 2015 at 5:09:50 PM UTC+10, Alberto Mancini wrote:
>
> 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 <alexwh...@gmail.com <javascript:>> 
> 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:" + obj 
>>>
>>> Hope 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+unsubscr...@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.

Reply via email to