Rectangle 27 0

Define your own formatter function like this in your colmodel,

[{name : "userRole", label: 'OV', width: 40, 
 editable:true, edittype:'checkbox',formatter: checkboxFormatter, 
  editoptions: {value:"True:False"},
function checkboxFormatter(cellvalue, options, rowObject) {
return "<input type='checkbox' name='checkboxIsCC' 
              onchange='your_own_function();'>";
}

javascript - Multiple checkbox columns in jqgrid. Handle onchange even...

javascript jquery checkbox jqgrid
Rectangle 27 0

I had an issue were not only I had more than 1 check box but also I had to update same column check box values based on the selection of the check box as well as modifying the same row columns.

In regards to the modification of the other checkboxes, when jqgrid modifies the data either by 'setCell' or 'setRowData' operations, it removes the click event. Also there is the problem that for checkboxes none of the edit functions are useful.

I manage to get bits from other people's solution and came to use the delegate jquery functions, that allows the binding of the click to be done each time an object that matches the selector is created. Also in this case only 1 checkbox of only 1 column could be checked at a time.

$(document).delegate("#alarmDownloadListView td[aria-describedby*='stopArm'] input", 'click', function () { 
// Function that modifies all the other checkboxes of the same column 
    deselectOthersStopArmAlarms(this, j);
    // Set the Pre and Pos Alarm values to default
    var fileIndex = $(this).closest('tr').index();
// Modification of the same row cells 
    if($(this).is(':checked')){
        alarmsGrid.jqGrid('setCell',fileIndex,'preAlarm', defaultPrePosStopArmAlarmValue);
    }else{
        alarmsGrid.jqGrid('setCell',fileIndex,'preAlarm', null);
    }
});

Do not mind the exact operations of the code, what is important is the operations that the binded function does. The CSS selector binds this function to all checkboxes whose name in my colmodel is stopArm.

javascript - Multiple checkbox columns in jqgrid. Handle onchange even...

javascript jquery checkbox jqgrid
Rectangle 27 0

The simplest way is to just handle an OnChange event of each CheckBox with a JavaScript function, which in turn is displaying a prompt box on select - whose input then gets saved in an associated Hidden field (or data-* attribute in HTML5), which gets cleared on unselect.

Then on submit in C# you iterate through all the CheckBox controls for a checked attribute, and all Hidden fields (or data-* attribute in HTML5) for their input.

c# - asp.net: get user input on treeview checked - Stack Overflow

c# javascript asp.net
Rectangle 27 0

checkboxes trigger "onchange" event if it is (un)checked.so rather listen for this event in your javascript code. And then check the whether the checkbox is checked in your event handler to apply changes to the total amount. Sample:

[HTML]
<input type="checkbox" name="check" id="check" value="1" onchange="updateAmount();"/>

[JS]
function updateAmount(){
     if($('input#check').is(':checked')){
           // checked
     }else{
          // unchecked
     }
}

php - jQuery checkbox does not trigger event after Select All method -...

php javascript jquery javascript-events checkbox
Rectangle 27 0

You can use beforeSelectRow callback. The demo demonstrate the approach. It uses the following code

beforeSelectRow: function (rowid, e) {
    var $target = $(e.target), $td = $target.closest("td"),
        iCol = $.jgrid.getCellIndex($td[0]),
        colModel = $(this).jqGrid("getGridParam", "colModel");
    if (iCol >= 0 && $target.is(":checkbox")) {
        alert("checkbox is " +
              ($target.is(":checked")? "checked" : "unchecked") +
              " in the column \"" + colModel[iCol].name +
              "\" in the row with rowid=\"" + rowid + "\"");
    }
    return true;
}

javascript - Multiple checkbox columns in jqgrid. Handle onchange even...

javascript jquery checkbox jqgrid