On Mar 22, 1:21 am, "A. Kong" <[email protected]> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.