Hi, Thomas,

Thanks for the detail explanation! After making the change, I can read
the title attribute from the Article object.

Cheers

On Mar 22, 10:43 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Mar 22, 1:21 am, "A. Kong" <anthony.hw.k...@gmail.com> wrote:
>
> > Hi, Thomas,
>
> > Thanks very much for the quick reply!
>
> > I am away from the workstation where the work is, so I cannot give
> > your suggestion a go yet.
>
> > But I have a question about the remedy you suggested, namely to access
> > the 'title' field using '_array[0].Article.title'
>
> > In my case, I would have expected GWT to be able to understand the
> > JSON "[]" representation as an array. GWT should be able to dispatch
> > each individual element in the array to Article class, which will use
> > native methods to map out individual attributes. That's why I assume
> > "this" in "this.title" correspond to "Aritcle:{...}"
>
> Your Article class corresponds to the object which is a direct child
> of the array, the one with an "Article" key. Your code expects it to
> be the object that's the value of this "Article" property.
> Let's try again:
> You receive:
>  [
>    {
>       "Article": { "title": ... }
>    },
>    {
>       "Article": { "title": ... }
>    },
>    ...
>  ]
> but process it as if it were:
>  [
>     { "title": ... },
>     { "title": ... },
>     ...
>
>  ]
>
> > Now let's say I changed the native code to 'array[0].Article.title'.
>
> I wasn't suggesting that. I was suggesting that either you use
> this.Article.title or add another JavaScriptObject representing the
> {'Article': ... } object, whose this.Article would be your current
> Article class.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to