jqGrid returns blank cells

送分小仙女□ 提交于 2019-11-27 02:16:55

I find the question very interesting. So I modified a little your code and it work now. You can see the results live here.

The corresponding JavaScript code is following

jQuery(document).ready(function() {
    jQuery("#list2").jqGrid({
        url: 'http://tables.googlelabs.com/api/query?sql=' +
                encodeURI('SELECT * FROM 333136 LIMIT 10') + '&jsonCallback=?',
        postData: "",     // don't send any typical jqGrid parameters
        datatype: "json", // or "jsonp"
        colModel:[
            {name:'ident',index:'ident',key:true,width:60,sorttype:'int'},
            {name:'date',index:'date', width:130},
            {name:'sourceId',index:'sourceId',width:80,sorttype:'int'},
            {name:'source',index:'source',width:150},
            {name:'tags',label:'tags',width:350}      
        ],
        jsonReader: {
            cell: "", // the same as  cell: function (obj) { return obj; }
            root: "table.rows",
            page: function (obj) { return 1; },
            total: function (obj) { return 1; },
            records: function (obj) { return obj.table.rows.length; }
        },
        rowNum:10,
        rowList:[10,20,30],
        pager: '#pager2',
        sortname: 'id',
        sortorder: "desc",
        viewrecords: true,
        loadonce: true,
        height: "100%",
        caption: "How to query Google Fusion Tables"
    });
    jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!