Categories | Question details Back To List | ||
not getting check box values if the checkboxes checked as default Hi, I am using treegrid which has checkboxes. when i check the checkbox manually, i can get those values in server side using form submission method. Suppose if check the checkbox values thru programing, i am getting those valuse using tmygrid.cells(rowId,3).cell.wasChanged=true; code. i can get those values in server side. Suppose if those checkboxes checked by default(using XML file $cell=new TXmlElement('cell'); $cell->Value=1; $row->Elements[]=$cell;)) Now i am trying to save default values by clicking save button. I cant able get defalut checked values in server side? how to do that? please help me. Thanks, Vel Answer posted by dhxSupport on Jun 22, 2009 03:33 If you are using mode where only changed rows are being sent to the server you should mark necessary rows as chended manually: tmygrid.cells(rowId,3).cell.wasChanged=true; Answer posted on Jun 22, 2009 03:54 I am not using any mode. mygrid = new dhtmlXGridObject('gridbox'); mygrid.selMultiRows = true; mygrid.imgURL = "themes/General/css/dhtmlxGrid/imgs/icons_greenfolders/"; mygrid.setHeader("<b>Module/Page</b>,<b>Add</b>,<b>Edit</b>,<b>View</b>,<b>Delete</b>"); mygrid.setInitWidths("400,150,150,150,150") mygrid.setColAlign("left,center,center,center,center") mygrid.setColTypes("tree,ch,ch,ch,ch"); mygrid.setColSorting("str,str,str,na,str") //mygrid.setEditable('off'); mygrid.init(); mygrid.enableAutoHeight(true,"1050") mygrid.setSkin("mt") mygrid.loadXML(xmlFile); mygrid.attachEvent("onCheck",doOnCheck); function doOnCheck(rowId,cellInd,state) { var action; if(cellInd=='1') action="add"; if(cellInd=='2') action="edit"; if(cellInd=='3') action="view"; if(cellInd=='4') action="delete"; if((action =="add")||(action =="edit")||(action =="delete")) { if((state!=false)) { mygrid.cells(rowId,3).setChecked(true); mygrid.cells(rowId,3).cell.wasChanged=true; } } } function save() { document.assignpermission.submit(); } This is my code. everythis is working fine except that checkbox values whose values checked as default. Answer posted by dhxSupport on Jun 22, 2009 05:45 >>This is my code. everythis is working fine except that checkbox values whose values checked as default. After grid was loaded you should code similar to the doOnCheck() function: mygrid.loadXML(xmlFile,function(){ for (var i=0; i<mygrid.getRowsNum(); i++){ mygrid.cellByIndex(i,1).cell.wasChanged=true; mygrid.cellByIndex(i,2).cell.wasChanged=true; mygrid.cellByIndex(i,3).cell.wasChanged=true; mygrid.cellByIndex(i,4).cell.wasChanged=true; } }); |