jqGrid的網站有關於如何使用分組功能的以下代碼示例,它工作得很好。運行時jqGrid分組功能消失addRowData
$(document).ready(function(){ var mydata = [ {id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"} , {id:"2",invdate:"2010-05-25",name:"test2",note:"note2",tax:"20.00",total:"320.00"}, .... ]; $("#list48").jqGrid({ data: mydata, datatype: "local", height: 'auto', rowNum: 30, rowList: [10,20,30], colNames:['Inv No','Date', 'Client', 'Amount','Tax','Total','Notes'], colModel:[ {name:'id',index:'id', width:60, sorttype:"int"}, {name:'invdate',index:'invdate', width:90, sorttype:"date", formatter:"date"}, {name:'name',index:'name', width:100, editable:true}, {name:'amount',index:'amount', width:80, align:"right",sorttype:"float", formatter:"number", editable:true}, {name:'tax',index:'tax', width:80, align:"right",sorttype:"float", editable:true}, {name:'total',index:'total', width:80,align:"right",sorttype:"float"}, {name:'note',index:'note', width:150, sortable:false} ], pager: "#plist48", viewrecords: true, sortname: 'name', grouping:true, groupingView : { groupField : ['name'], groupDataSorted:false, groupColumnShow:[true] }, caption: "Grouping Array Data" });
但如果我刪除:
data: mydata,
,並通過使用addRowData組成的網格:
$('#list48').addRowData("id", mydata);
分組消失了,任何人都遇到類似的問題?能否請你幫忙?
謝謝!