【发布时间】:2014-03-10 12:52:50
【问题描述】:
这里是第一个计时器......所以提前谢谢。
我有一个 JQGrid 页面。 这是我的 JQGrid(最新版本...昨天下载)设置:
$(function() {
$("#list").jqGrid({
caption: "My first grid",
url: "demo_data.php",
loadonce: true,
datatype: "xml",
mtype: "GET",
pager: "#pager",
height: "100%",
autowidth: true,
altRows: false,
rowTotal: 2000,
rowNum: 10000,
rowList: [10, 25, 50],
viewrecords: true,
autoencode: true,
colNames: ["Publisher", "First Name", "Last Name", "EMail"],
colModel: [
{name: "pid"},
{name: "fname"},
{name: "lname"},
{name: "email", summaryType:'count',summaryTpl:'<b>{0} Item(s)</b>'}
],
sortname: "pid",
sortorder: "desc",
grouping: true,
groupingView: {
groupField: ['pid'],
groupOrder: ['asc'],
groupCollapse : true,
groupText : ['<b>{0} - {1} Item(s)</b>'],
groupSummary : true
},
ignoreCase: true
});
$("#list").jqGrid('filterToolbar',{
stringResult: true,
searchOnEnter : false,
defaultSearch: "cn"
});
});
当 loadonce 为真时,我在控制台上出现错误:
Uncaught TypeError: Cannot read property '0' of null
这个错误停止了这行代码的脚本:
if(!grdata[kk - offset]) { break; }
关于 GroupRender 函数。
当我将 loadonce 设为 false 时,分组一切正常,但我失去了令人敬畏的客户端数据操作。
这是我作为数据发送的 XML 文件:
<rows>
<row id = '1'>
<cell></cell>DataA</cell>
<cell>NameA</cell>
<cell>LastNameA</cell>
<cell>EMail A</cell>
</row>
<row id = '2'>
<cell>DataA</cell>
<cell>NameB</cell>
<cell>LastNameB</cell>
<cell>EMail B</cell>
</row>
<row id = '1'>
<cell>DataB</cell>
<cell>NameAA</cell>
<cell>LastNameAA</cell>
<cell>EMail AA</cell>
</row>
<row id = '1'>
<cell>DataB</cell>
<cell>NameBB</cell>
<cell>LastNameBB</cell>
<cell>EMail BB</cell>
</row>
</rows>
提前感谢您的帮助:)
【问题讨论】:
标签: javascript jquery xml jqgrid grouping