我正在使用jqGrid。分頁沒有得到反映,可能是什麼問題?我檢查了Firefox 4.1和IE8,但並未在Chrome上顯示jqGrid。jqGrid分頁問題
var filesystem=[];
$(xml).find('file').each(function(){
var row={};
row.total=$(this).attr('total');
row.free=$(this).attr('free');
row.used=$(this).attr('used');
row.percentage=$(this).attr('percentage');
filesystem.push(row);
});
$('#detailTable').empty();
$('<div>')
.attr('id','diskUsageSpan')
.html('<div class="titleBlue">Configuration>System>Disk Usage</div>'+
'<table id="list1"></table>'+
'<div id="gridpager"></div>'+
'</div>')
.appendTo('#detailTable');
更新
jQuery("#list1").jqGrid({
datatype: "clientSide",
height: 250,
colNames:['id','Total Space','Free Space', 'Used Space', 'Used Percentage'],
colModel:[
{name:'id',index:'id', width:90, align:"right"},
{name:'total',index:'total', width:90, align:"right"},
{name:'free',index:'free', width:90, align:"right"},
{name:'used',index:'used', width:90, align:"right"},
{name:'percentage',index:'percentage', width:120, align:"right"}
],
pagination:true,
pager : '#gridpager',
rowNum:10,
viewrecords: true,
gridview: true,
edit:false,
add:false,
del:false
});
for(var i=0;i<filesystem.length;i++)
jQuery("#list1").jqGrid('addRowData',i+1,filesystem[i]);
jQuery("#list1").setGridParam({rowNum:10}).trigger("reloadGrid");
@doctrey:請看看問題 – Ricky
@Tomas:我創建了一個數據集來匹配jqGrid,並且它也加載,但分頁不起作用。你可以請看看。謝謝 – Ricky
@Oleg:我跟着你的答案[這裏](http://stackoverflow.com/questions/3491963/pagination-problem-in-jqgrid-with-array-data),但仍然沒有運氣,你可以看看也是問題。謝謝:) – Ricky