$ t.p.colModel [i]在grid.base.js中未定义

时间:2011-09-08 05:14:55

标签: jqgrid

当我调用getrowdata()时,我收到此错误$ t.p.colModel [i]在grid.base.js中未定义

jQuery(jqgrid).jqGrid({
            url: url,
            datatype: 'json',
            mtype: 'GET',
            colNames: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
            colModel: [{ name: 'A', index: 'A', width: 50, align: 'right', sortable: true, resizable: false },
            { name: 'B', index: 'B', width: 50, align: 'right', sortable: true, sorttype: 'int', title: false, resizable: false },
            { name: 'C', index: 'C', width: 50, align: 'right', sortable: true, sorttype: 'int', resizable: false },
            { name: 'D', index: 'D', width: 40, align: 'right', sortable: true, sorttype: 'int', title: false, resizable: false },
            { name: 'E', index: 'E', width: 75, align: 'right', sortable: true, sorttype: 'float', resizable: false },
            { name: 'F', index: 'F', width: 75, sortable: true, datefmt: ' M  d, y H:i:s', resizable: false },
            { name: 'G', index: 'G', width: 75, sortable: true, datefmt: ' M  d, y H:i:s', resizable: false },
            { name: 'H', index: 'H', width: 500, sortable: true, sorttype: 'text', resizable: false },
            { name: 'I', index: 'I', width: 300, sortable: true, sorttype: 'text', resizable: false}],
 jsonReader: {
                root: "A",
                page: "page",
                total: "total",
                records: "records",
                repeatitems: false
            }
});

jsondata格式是

{ "total":"4",
    "page":"1",
    "records":"35",
    "A":[{
            "A":"01.000",
            "B":"01.000",
            "C":"01.000",
            "D":"1",
            "E":"1.075",
            "F":" 19:17:09",
            "G":" 11 19:17:09",
            "H":"dfsd",
            "I":""}]} 

收到错误:$t.p.colModel[i] is undefined in grid.base.js(line 2470)

2 个答案:

答案 0 :(得分:2)

我在调用$("#myGrid").delRowData("myRowId");时使用jqGrid 3.6.2遇到同样的问题 原因是在运行时添加了一个包含html表<table><tr><td>cell value</td> ...的新单元格。似乎方法$("#myGrid").delRowData通过包含内部表的方法错误地计算了jqGrid tds。

答案 1 :(得分:0)

首先,您的JSON数据应以“{”("{"total":"4",...")开头。 其次,因为您使用“A”属性作为行的数组名称("A":[),所以您应该使用以下jsonReader

jsonReader: {
    root: "A",
    repeatitems: false
}
相关问题