English 中文(简体)
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.ie/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.





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签