jqGrid中的错误 - TypeError:无法读取null的属性“id”

时间:2017-09-15 15:50:33

标签: javascript jquery json jqgrid

使用jqGrid时遇到问题。它显示Loading ...和浏览器控制台显示以下内容。

    Uncaught TypeError:  Cannot read property 'id' of null
at Object.getAccessor (jquery.jqGrid.4.4.1.min.js:15)
at $ (jquery.jqGrid.4.4.1.min.js:60)
at G (jquery.jqGrid.4.4.1.min.js:76)
at HTMLTableElement.<anonymous> (jquery.jqGrid.4.4.1.min.js:127)
at Function.each (jquery-1.8.3.min.js:2)
at init.each (jquery-1.8.3.min.js:2)
at init.b.fn.jqGrid (jquery.jqGrid.4.4.1.min.js:30)
at loadMyGrid (taggingSheepWelfare.js:5)
at HTMLDocument.<anonymous> (displaySummary.do:2822)
at l (jquery-1.8.3.min.js:2)

这是我用过的jqgrid。

function loadMyGrid(tagData){
var tagDataJson = { "id" : "sequenceNumber", "page" : "1","records" : 0, "rows" : JSON.parse(tagData)};

$("#myTable").jqGrid({
          datatype : "jsonstring",
        datastr : tagDataJson,
        jsonReader : { repeatitems : false},
        height: "100%",
        width: "70%",       
        rowNum : 6,
        loadonce : true,
        gridview : true,
        viewrecords : true,
        scrollOffset: 0,
        emptyrecords : "Nothing to display",
        pgbuttons : true,
        pginput : true,
        ignoreCase: true, 
        localReader : {id:'sequenceNumber'}, 
        pgtext : "Page {0} of {1}",
        loadtext : "Loading...",
    colNames : ['sequenceNumber', 'Tag No', 'ColumnA' ,  'ColumnB', 'ColumnC'],   
    colModel: [

          { name: 'sequenceNumber', index:'sequenceNumber',align:'center', width: 130, hidden:true},/*sortable:false*/
          { name: 'tagNo', index:'tagNo', align:'center', width: 130},
          { name: 'a', index:'a', align:'center', width: 90},
          { name: 'b', index:'b', align:'center', width: 90},
          { name: 'c', index:'c', align:'center', width: 90 },
    ],
     pager: "#SampleGridPager",
    caption: "&nbsp;Tag Grid",
    hidegrid: false
});
$("#myTable").jqGrid('filterToolbar', { stringResult: true , defaultSearch: "cn" });

}

此处无法解决问题。

0 个答案:

没有答案