使用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%'});
感謝您的迴應,但據我所見,唯一的區別是版本號。我試圖使用4.0,在演示使用3.8.2,有調用本地數據數組的方法改變了嗎? – 2011-05-10 20:40:32
@ 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