spring3 mvc + JqGrid 做个demo,遇到了这样的一个问题,如下:
TypeError: b is undefined
原因在于jqgrid中配置缺少内容,报错时候如下的配置。
$(function(){
jQuery("#list3").jqGrid({
url: contextPath + '/sys/user/list',
datatype: "json",
colNames:['user_id','user_name', 'password', 'description','employee_id','enabled_flag'],
colModel:[
{name:'user_id',index:'user_id', width:60, sorttype:"int"},
{name:'user_name',index:'user_name', width:90},
{name:'password',index:'password', width:100},
{name:'description',index:'description', width:80, align:"right"},
{name:'employee_id',index:'employee_id', width:80,align:"right",sorttype:"int"},
{name:'enabled_flag',index:'enabled_flag', width:150, sortable:false}
],
rowNum:10,
rowList:[10,20,50],
pager: '#pager3',
sortname: 'user_id',
viewrecords: true,
sortorder: "desc",
loadonce: true,
caption: "用户列表"
});
});
需要在配置信息中添加,如下:
jsonReader : {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
cell: "cell",
id: "user_id"
}