1

I have a custom checkbox column on my JQGrid, each time the user clicks on the checkbox I would like to display all the row information in a message box.

My jsfiddle:

I have tried the following, but does nothing:

function getCurrentBinRow() {
       var grid = $('#grid'),
           selRowId = grid.jqGrid('getGridParam', 'selrow'),
           celValue = grid.jqGrid('getCell', selRowId, 'Inv No');
}

Thanks

Gowri
  • 1,832
  • 3
  • 29
  • 53
user142617
  • 386
  • 2
  • 7
  • 18

1 Answers1

1

One can use simple formatter: "checkbox" with formatoptions: { disabled: false } and use beforeSelectRow to detect changing of the checkbox:

beforeSelectRow: function (rowid, e) {
    var $self = $(this),
        iCol = $.jgrid.getCellIndex($(e.target).closest("td")[0]),
        cm = $self.jqGrid("getGridParam", "colModel"),
        localData = $self.jqGrid("getLocalRow", rowid);
    if (cm[iCol].name === "MyPrint" && e.target.tagName.toUpperCase() === "INPUT") {
        // set local grid data
        localData.MyPrint = $(e.target).is(":checked");
        alert(JSON.stringify(localData));
    }

    return true; // allow selection
}

See http://jsfiddle.net/OlegKi/rk7b1dbx/9/. See the answer on very close question.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798