I have a column where I intend to have multiple check-boxes within the same cell. The below code works. How do I set up events to catch when a checkbox status changes ?
<cell><![CDATA[@Html.Raw("<input type='checkbox' name='Priority'/>Priority<BR><input type='checkbox' name='Limit'/>Limit<BR>")]]></cell>
For others having the same issue, I ended up attaching a onRowCreated event to the grid, then parsing the field to get hold of the checkbox info, something like this…
var cell = oGridProps.GridObject.cells(sRowID, nColChangeTo); //checkbox cell
for (n = 0; n < cell.cell.childNodes.length; n = n + 4) {
var chkboxes = new Object();
asTo = cell.cell.childNodes[n + 2].data.split(" = ");
chkboxes.box1= cell.cell.childNodes[n];
chkboxes.box2= cell.cell.childNodes[n + 1];
chkboxes.RowID = sRowID;
chkboxes.Grid = this;
chkboxes.Alias = asTo[0];
chkboxes.Value = asTo[1];
chkboxes.Name = chkboxes.box1.getAttribute("name");
mcolChkBox.add(sRowID + "_" + chkboxes.box1.getAttribute("name"), chkboxes);
mcolChkBox.add(sRowID + "_" + chkboxes.box2.getAttribute("name"), chkboxes);
if (cell.cell.childNodes[n].onchange = function (e) {
...
}
if (cell.cell.childNodes[n+1].onchange = function (e) {
...
}
}