我正在从 cassandra 数据库中读取数据并在 jqGrid 中显示。但它在所有页面上显示相同的记录
我正在使用来自http://javahunter.wordpress.com/2010/12/07/jqgrid-example/的代码
这是我的 jsp 文件:请说明为什么分页不起作用。提前谢谢。
<title>User Grid</title>
<script>
function fillGridOnEvent() //function called through ready function
{
// $("#jQGrid").html("<table id=\"list\"></table><div id=\"page\"></div>");
jQuery("#list").jqGrid({
url:'<%=request.getContextPath()%>/JQGridServlet?q=1&action=fetchData',
datatype: "xml",
// cellEdit:true,
// width:'1000',
height: '500',
// altRows: true,
// width: 1000,
colNames:['SrNo','Source IP','Destination IP','Bytes Sent',"Bytes Received"],
colModel:[
{name:'srNo',index:'srNo', width:90,sortable:true,align:'center'},
{name:'stdName',index:'stdName',
width:130,sortable:false,align:'center',editable:true},
{name:'stdStd',index:'stdStd', width:100,sortable:false,align:'center'},
{name:'stdRollNo',index:'stdRollNo', width:180,sortable:false,align:'center'},
{name:'view',index:'view', width:100,sortable:false,align:'center'}
],
multiselect: false,
autowidth:true,
paging: true,
viewrecords: true,
// viewpages: true,
rowNum:10,
sortname:'srNo',
// sortorder:asce,
rowList:[10,20,30,40,50],
// recordtext: "View {0} - {1} of {10}",
pager: jQuery('#page'),
loadComplete:function()
{
},
loadonce:false,
caption: "Student Details"
}).navGrid('#page',{edit:true,add:true,del:true});
}
jQuery().ready(function (){
alert("in ready");
fillGridOnEvent();
});
</script>
</head>
<style>
.ui-jqgrid tr.jqgrow td {white-space: normal}
</style>
<body onload="fillGridOnEvent();">
<table id="list"><tr><td/></tr></table>
<div id="page" align="center" >
</div>
</body>
</html>