: nth-child , <td>, . >input:checked, . , jQuery, , .closest("tr.jqgrow") , . - , . $.map .
$("#getIds").button().click(function () {
var $checked = $grid.find(">tbody>tr.jqgrow>td:nth-child(" +
(iCol + 1) + ")>input:checked"),
ids = $.map($checked.closest("tr.jqgrow"),
function (item) { return item.id; });
alert("The list of rowids of the rows with checked chechboxs:\n" + ids.join());
});
iCol getColumnIndexByName
var getColumnIndexByName = function (grid, columnName) {
var cm = grid.jqGrid("getGridParam", 'colModel'), i, l;
for (i = 0, l = cm.length; i < l; i += 1) {
if (cm[i].name === columnName) {
return i;
}
}
return -1;
};
.
The demo demonstrates the above code in real time.
source
share