I have a grid with checkbox in a column. When I check the box the database will be updated with the value “1”. When I uncheck it again the database will be updated with the value “0”.
However, I get two records with “1” in the database each time i check or uncheck.
dhxGrid = dhxLayout.cells("a").attachGrid();
dhxGrid.setImagePath("../inc/codebase/imgs/");
dhxGrid.attachHeader(",#text_filter,#text_filter,#select_filter,#select_filter,,#select_filter");
dhxGrid.setHeader("Ordre,Dato,Rute/HO,Via,Posetype,Kasser,Behandlet");
dhxGrid.setColumnIds("Ordre,Dato,Rute/HO,Via,Posetype,Kasser,Behandlet");
dhxGrid.setInitWidths("50,150,*,80,200,100,100");
dhxGrid.setColAlign("left,left,left,center,left,center,center");
dhxGrid.setColSorting("str,str,str,str,str,str,str");
dhxGrid.setDateFormat("%Y-%m-%d");
dhxGrid.enableTooltips("true,true,true,true,true,true,true");
dhxGrid.setColTypes("ro,ro,ro,ro,ro,ro,ch");
dhxGrid.attachEvent("onCheck",doOnCheckBoxSelected);
if(privLevel == 'read') dhxGrid.editable(false);
dhxGrid.loadXML("xml/LoadGrid.php");
// dhxGrid.enableTooltips("false,false,false,false");
dhxGrid.init();
dhxGrid.preventIECaching(true);
dhxGrid.enableSmartRendering(true);
function doOnCheckBoxSelected(rID, cInd, state) {
if (state == '1') {
dp.init(dhxGrid);
dhxGrid.cells(rID,6).setValue('1');
dp.setUpdated(rID,true);
} else {
dp.init(dhxGrid);
dhxGrid.cells(rID,6).setValue('0');
dp.setUpdated(rID,true);
};
return true;
};
Can someone please tell me what I’m doing wrong?