Getting the clicked Grid row’s data

To trigger when the user clicks on a grid row, you can use the jqxGrid’s ‘rowselect’ event(if the selection mode is set to ‘singlerow’, ‘multiplerows’ or ‘multiplerowsextended’), otherwise in the cells selection modes(‘singlecell’, ‘multiplecells’ or ‘multiplecellsextended’) the grid raises the ‘cellselect’ event. For example:
$("#jqxgrid").bind('rowselect', function (event) {
var row = event.args.rowindex;
});
The clicked row’s index is stored in the event.args object. To get the row’s data, we can use the Grid’s ‘getrowdata’ method.
var datarow = $("#jqxgrid").jqxGrid('getrowdata', index);
Here’s how to get the clicked grid row’s data.
$("#jqxgrid").bind('rowselect', function (event) {
var row = event.args.rowindex;
var datarow = $("#jqxgrid").jqxGrid('getrowdata', row);
});
To get the clicked grid row when the selection mode is ‘singlecell’, ‘multiplecells’ or ‘multiplecellsextended’, use:
$("#jqxgrid").bind('cellselect', function (event) {
var row = event.args.rowindex;
var datafield = event.args.datafield;
var datarow = $("#jqxgrid").jqxGrid('getrowdata', row);
});

About admin


This entry was posted in JavaScript, JavaScript Plugins, JavaScript Widgets, jQuery, jQuery Plugins, jQuery UI, jQuery UI Plugins, jQuery UI Widgets, jQuery Widgets, jQWidgets, jqxGrid and tagged , , , , , , , , , , , , , . Bookmark the permalink.



Leave a Reply