I have a grid with editable cells and checkboxes. I have attached both an “onEditCell” event which fires correctly but doesn’t allow change even if I return true. I have also attached an onCheck event which never fires. What am I doing wrong.
Here is a simplified version of my code, to give you something reproducible.
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<link rel="STYLESHEET" type="text/css" href="dhtmlxgridv51/codebase/dhtmlxgrid.css">
<link rel="STYLESHEET" type="text/css" href="dhtmlxgrid/dhtmlxgrid.css">
<link rel="stylesheet" type="text/css" href="dhtmlxgrid/skins/dhtmlxgrid_dhx_skyblue.css">
</head>
<body onload="doInitGrid()" ">
<div id="content">
<div id="mygrid_container" style="width:2000px;height:200px"></div>
</div>
<script src="dhtmlxgridv51/codebase/dhtmlxgrid.js"></script>
<script>
var mygrid;
function doInitGrid(){
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("dhtmlxgridv51/codebase/imgs/");
mygrid.setHeader("Name,Days,Est Start,Locked");
mygrid.attachHeader("#text_filter,#text_filter,#text_filter,#text_filter");
mygrid.setInitWidths("90,50,80,50");
mygrid.setColAlign("left,right,left,center");
mygrid.setColSorting("str,str,dateSort,str");
//set all columns to read only
mygrid.setColTypes("ro,ed,dhxCalendarA,ch");
mygrid.setColumnIds(",days,eststart,locked");
mygrid.enableAutoWidth(true);
mygrid.attachEvent("onRowDblClicked", onClickOpen);
mygrid.attachEvent("onDrag", onDragRecalculate);
mygrid.setSkin("light");
mygrid.enableDragAndDrop(true);
mygrid.enableEditEvents(true,false,false);
mygrid.setDateFormat("%m/%d/%Y");
mygrid.init();
data={
rows:[
{ id:1, data: ["Smith, John", "2", "10/10/2017", "0"]},
{ id:2, data: ["Jones, Sam", "3", "10/12/2017", "0"]},
{ id:3, data: ["Walters, Jane", "4", "10/15/2017", "0"]}
]
};
mygrid.parse(data,"json");
mygrid.attachEvent("onEditCell", function(stage,rId,cInd,nValue,oValue){
onChangeTest(stage,rId,cInd,nValue,oValue);
});
mygrid.attachEvent("onCheck", function(rId,cInd,nValue) {
onCheckLocked(rId,cInd,nValue);
});
}
function onChangeTest(stage,rId,cInd,nValue,oValue) {
//alert ("rID: " + rId + ", cInd: " + cInd + ", nValue: " + nValue + ", oValue: " + oValue);
return true;
}
function onCheckLocked(rId,cInd,nValue) {
return true;
}
function onClickOpen(rId) {
}
function onDragRecalculate(sId,tId,sObj,tObj,sInd,tInd) {
}
</script>
</body>