Reputation: 96
I am trying to get the value of a cell from jQgrid for use in a javascript.
I tried this
$('#grid').click(function(rowid,iCol,cellcontent,e,id) {
var rowData = $(this).getRowData(id);
var temp= rowData['ecu'];
var existingtext = $("#debug").html()+'<br />';
$("#debug").html(existingtext +" "+cellcontent+" "+e+" "+iCol+" "+rowid+" "+temp);
But I keep getting undefined and [object, object]
Upvotes: 0
Views: 891
Reputation: 222017
Your main error is that you used jQuery.click instead of jqGrid callback like onCellSelect. If you define jqGrid you can include in the list of its options any from supported callback functions like onCellSelect
:
$('#grid').jqGrid({
// any other options which you need
onCellSelect: function (rowid, iCol, cellcontent) {
$('#debug').append('<br />cellcontent=' + cellcontent +
', rowid=' + rowid + ', iCol=' + iCol +
', ecu=' + $(this).jqGrid('getCell', rowid, 'ecu'));
}
});
Upvotes: 1