2011-05-10 52 views
0

使用jqGrid v4顯示一些本地數據。我試圖遵循這個簡單的例子@http://www.ok-soft-gmbh.com/jqGrid/SimpleLocalGrid.htm。我的結果是,尋呼機元素是正確的,但他們被禁用。如果有人可以幫忙指出我可能會出錯的地方,我已附上我的代碼。任何幫助讚賞。 感謝當使用本地數據類型時,jqGrid v4.0傳呼機不工作

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%'}); 

回答

1

對不起,但我不能重現你的問題。你如何看到here尋呼機(轉到下一頁或到最後一頁)是不受限制的。您應該將您的代碼與我的演示完全比較,以找出問題所在。

+0

感謝您的迴應,但據我所見,唯一的區別是版本號。我試圖使用4.0,在演示使用3.8.2,有調用本地數據數組的方法改變了嗎? – 2011-05-10 20:40:32

+0

@ user746980:我在演示中使用了jqGrid 4.0。你可以看看你是否打開使用的文件http://www.ok-soft-gmbh.com/jqGrid/jquery.jqGrid-4.0.0/js/jquery.jqGrid.min.js。 – Oleg 2011-05-10 20:54:07

0

只要確保你的server.php, 當您查詢,最後你設定的限制和排序: 「ORDER BY $ SIDX $ SORD LIMIT $開始,$限制」

第一個,使您的表格可排序(ORDER BY), 和第二個,使用限制等式0-5,5-10,使您的網格在一組記錄中移動!

相關問題