Reputation: 1
I have been trying to retrieve data from jqGrid when I double click but with no success. I am able to get the row Id. Please can anyone help check this code for me and let me know what is wrong.
$(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);
}
});
});
The alert display the iRow but does not display subName.
Upvotes: 0
Views: 3783
Reputation: 3123
Try:
ondblClickRow: function(id,iRow,icCol,e)
{
alert(iRow);
var rowData = $(this).jqGrid('getRowData',id);
...
You were using iRow
and not the rowID of 'id`. For clarity (though it shouldn't matter really) may I recommend your ondblClickRow be labeled as such:
ondblClickRow: function (rowid, iRow, iCol, e) {
Upvotes: 1