0
我一直試圖從jqGrid檢索數據,當我雙擊但沒有成功。我能夠獲得行ID。請任何人都可以幫我檢查這段代碼,並讓我知道什麼是錯的。jqGrid getRowData不起作用
$(function(){
$("#itemlist").jqGrid({
url:urld,
datatype: 'json',
mtype: 'POST',
colNames:['Subscriber Id','Subscriber Name','Contact Person','Contact Email','Telephone'],
colModel :[
{name:'id', index:'id', width:100,sortable:true},
{name:'subscribername', index:'subscribername', width:300,sortable:true},
{name:'contactperson', index:'contactperson', width:200,sortable:true},
{name:'contactemail', index:'contactemail', width:200,sortable:true},
{name:'telephone', index:'telephone', width:100,sortable:true}
],
pager: '#pager',
pgbuttons:true,
rowList:[10,20,30],
sortorder: 'desc',
viewrecords: true,
gridview: true,
loadonce: true,
height: 'auto',
altRows:true,
altclass: 'oddRow',
caption: 'Subscriber',
ondblClickRow: function(id,iRow,icCol,e)
{
alert(iRow);
var rowData = jQuery("#itemlist").jqGrid('getRowData',iRow);
var subName = rowData['subscribername');
alert(subName);
}
});
});
該警報顯示iRow但不顯示subName。
這是否解決了你的問題? – Mark 2013-03-19 20:12:32