I have a rather complicated grid with two columns formatted as a checkbox. These columns are defined as follows:
{ name: 'Alert_A', index: 'Alert_A', width: 22, align: 'center', sortable: false,
formatter: CheckBoxFormatter, editable: true, edittype: 'checkbox', editoptions: {value: "True:False"},
formatoptions: {disabled: false}, classes: "Alert_A" },
{ name: 'Alert_B', index: 'Alert_B', width: 22, align: 'center', sortable: false,
formatter: CheckBoxFormatter, editable: true, edittype: 'checkbox', editoptions: { value: "True:False" },
formatoptions: {disabled: false}, classes: "Alert_B" }
A custom formatter is CheckBoxFormatternecessary because I need to configure the disabled attribute of each checkbox depending on some custom rules, so I borrowed my own 'checkbox' formatter and added my own custom rules.
I also have an external html button element, and when I click on it, I need to execute some code, depending on what combination of checkbox selection was made. My code is as follows:
$('#btnAlert').button().click(function (event) {
event.preventDefault();
var dashboardID = '#<%=dashboard.ClientID %>';
doWork(dashboardID);
});
and then doWorkfunction
var keys = $(dashboardID).getDataIDs();
for (var i = 0; i < keys.length; i++) {
var rowData = $(dashboardID).getRowData(keys[i]);
...
var reminderA = $(rowData.Alert_A).is(":checked");
var reminderB = $(rowData.Alert_B).is(":checked");
...
... other application logic here
}
, , reminderA reminderB , (, jqgrid). , , .
? ?
!