当我双击但没有成功时,我一直试图从 jqGrid 检索数据。我能够获得行 ID。请任何人都可以帮我检查此代码并让我知道出了什么问题。
$(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。