我使用jqGrid v4显示一些本地数据。我试图遵循简单的例子@ http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGrid.htm。我的结果是寻呼机元素是正确的,但它们被禁用。如果有人能指出我可能出错的地方,我附上了我的代码。任何帮助赞赏。 感谢
var myData = [
{ id:'1', name:'a', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'2', name:'b', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'3', name:'c', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'4', name:'d', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'5', name:'e', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'6', name:'f', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'7', name:'g', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'8', name:'h', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'9', name:'i', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'10', name:'j', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'11', name:'k', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'12', name:'l', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'13', name:'m', dob:'2000-08-26',address:'here',telNo:'2587456'},
{ id:'14', name:'n', dob:'2000-08-26',address:'here',telNo:'2587456'}
];
$("#resultGrid").jqGrid({
datatype: "local",
data: myData,
autowidth:true,
colNames:['ID','Name', 'DOB', 'Address','Telephone Number'],
colModel:[
{name:'id',index:'id', sorttype:"text"},
{name:'name',index:'name', sorttype:"text"},
{name:'dob',index:'dob', sorttype:"date", formatter:"date"},
{name:'address',index:'address', sorttype:"text"},
{name:'telNo',index:'telNo', align:"right",sortable:false}
],
rowNum:10,
rowList:[5,10,20],
pager: '#pager',
gridview:true,
rownumbers:true,
viewrecords: true,
sortorder: 'desc',
caption:'Search Results',
height: '100%'});
答案 0 :(得分:1)
抱歉,但我无法重现您的问题。如何查看here寻呼机(转到下一页或最后一页)不会被废除。您应该将您的代码与我的演示完全比较,以找出问题所在。
答案 1 :(得分:0)
请确保在server.php中, 当您查询时,最后设置限制和排序: “订购$ sidx $ sord LIMIT $ start,$ limit”
第一个,使您的表可排序(ORDER BY), 第二个,使用限制eq 0-5,5-10,使你的网格在记录集内移动!