This question is specific to jqGrid. I learned that we can use .jqgrow item with mouseover event to retrieve the row information like the following:
gridComplete: function () {
$('.jqgrow').mouseover(function(e) {
var rowId = $(this).attr('id');
console.log('You rolled over ' + rowId);
});
}
My question is how can we retrieve the column information, cell name information and cell content information in such an event. Thanks in advance.
First of all you don’t need to bind
mouseoveron every row. It’s enough to bind the event once on the whole grid body. Theeparameter of the event hastargetproperty which are initialized to the object which is the origin of themouseoverevent. So you can use jQuery.closest to find the<td>and<tr>elements which are in the current context. In the way you save memory and improve a little the performance of the solution.The demo shows how all works in jqGrid. The code which are used is
The output which will be produced by the demo looks like the following