Man, you made my day :o) Thanks!

On Nov 20, 6:49 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Sunday, November 20, 2011 5:39:04 PM UTC+1, jogo wrote:
>
> > Hi Thomas,
>
> > > Any reason you're not coding this directly in JSNI, without the eval()?
> > Great point. I was able to fix one JSNI function (mentioned above)
> > that just gets the title & id with the solution you suggested. Thank
> > you.
>
> > But unfortunately, there is one even more complex method, that gets
> > data from Google Spreadsheet feed and here I have to use the "evil"
> > function. These feeds are quite complex and keys in these feeds are
> > dynamically generated based on the names of columns in a spreadsheet.
>
> > Here is an example JSON feed:
>
> >https://spreadsheets.google.com/feeds/list/o03712292828507838454.6243...
>
> > If you check that feed you will notice, that keys where are stored
> > spreadsheet values are prefixed with 'gsx' + name of the column. There
> > are three columns in the spreadsheet - year, revenue and profit and
> > three corresponding JSON keys gsx$year, gsx$revenue and gsx$profit.
>
> > My code looks like this:
> >     public static native String parseSpreadsheetFeed(String json) /*-{
> >         if (json != null) {
> >             var obj = JSON.parse(json);
> >             var entries = obj.feed.entry;
>
> >             // iterate over entries
> >             for (var i in entries) {
>
> >                 // iterate over keys
> >                 for (var j in entries[i]) {
> >                     var prefix = j.split('$')[0];
>
> >                     // process only keys prefixed with 'gsx'
> >                     if (prefix == 'gsx') {
> >                         eval('var data = obj.feed.entry[' + i + '].' +
> > j + '.$t');
> >                         ...
>
> > And here I can't just replace the eval method with:
> > var data = obj.feed.entry[i].j.$t;
>
> > That wouldn't work.
>
> var data = obj.feed.entry[i][j].$t;
>
>
>
>
>
>
>
>

-- 
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-toolkit@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