开发者

JqGrid with Google Fusion Tables

Trying to get jqGrid to work with Google fusion tables.

Can't seem to find the event in jqGrid that allows you to control where it gets data from.

Would accept an equivalent javascript table engine that does this job better.

If you could link to an example or provide one in your answer, thanks.


Edit: OK here is how far I've gotten

I know how to get jqGrid to request the Google fusion tables but I can't get it to parse the JSON. I can't seem to find any decent documentation for the jsonreader part of jqGrid that explains what each variable does.

http://cablegate.politicswiki.i开发者_运维技巧e/test.html is where I'm currently at.


Seems to be quite a bit of flexibility:

http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options

Worse case scenario you can convert Google Fusion to XML or JSON in a script and render it that way.


It is not event but property. See example here: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data You can define data source as JSON, function, xml, etc.


This should work:

jsonReader: {
    repeatitems: false,
    root: function (obj) { 
        var rows = new Array();
        for(var rowNum = 0; rowNum < obj.table.rows.length; rowNum++)
        {
            var row = new Object();
            for (var colNum = 0; colNum < obj.table.cols.length; colNum++) {
                row[obj.table.cols[colNum]] = obj.table.rows[rowNum][colNum];
            }
            rows.push(row);
        }
        return rows;
    },
    page: function (obj) { return 1; },
    total: function (obj) { return 1; },
    records: function (obj) { return obj.table.rows.length; }
}

And don't forget to change the name property of the ident column to id as that is the name that Google Fusion Tables sends it with, you can leave the label as ident if you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜