Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Massimo on Jul 29, 2008 10:02
open dhtmlx forum
when i eidt cell (cell is undefined)

I i try to update my mysqlDB but when i edit the cell and press update buton, i recive the error
(cell is undefined)
I work with zendframework

var mygrid;
var newId = (new Date()).valueOf();
function doInitGrid(){
mygrid = new dhtmlXGridObject('mygrid_container');
mygrid.setImagePath("dhtmlxGrid/codebase/imgs/");
mygrid.setHeader("Organizzatore,attivo");
mygrid.setInitWidths("*,150");
mygrid.setColAlign("left,right");
mygrid.setSkin("light");
mygrid.setColSorting("str,int");
mygrid.setColTypes("ed,ed");
// mygrid.attachEvent("onRowSelect",doOnRowSelected);

mygrid.init();
mygrid.loadXML("/news/read/format/xml");
myDataProcessor = new dataProcessor("/news/update");
myDataProcessor.enableDebug(true);
myDataProcessor.enableDataNames(true);
myDataProcessor.setVerificator(1);
myDataProcessor.setVerificator(3,checkIfNotZero);
myDataProcessor.setUpdateMode("off");
//available values: cell (default), row, off
myDataProcessor.defineAction("error",myErrorHandler);
myDataProcessor.setTransactionMode("GET");
myDataProcessor.init(mygrid);
}

function myErrorHandler(obj){
alert("Error occured.\n"+obj.firstChild.nodeValue);
myDataProcessor.stopOnError = true;
return false;
}

function checkIfNotZero(value,colName){
if(value.toString()._dhx_trim()=="0"){
showMessage(colName+ " should not be 0")
return false
}else
return true;
}
function doOnRowSelected(rowID,celInd){
//alert("Selected row ID is "+rowID+"\nUser clicked cell with index "+newId);
}
function showMessage(msg){
var msger = document.getElementById("messanger");
msger.innerHTML = msg;
clearTimeout(toRef)
toRef = setTimeout("showMessage(' ')",5000)
}
//these functions doesn't have direct relation to data processor. It related to this example interface only.
function doOnAutoupdateChecked(state){
if(state){
document.getElementById("updmdflt").click()
//myDataProcessor.setUpdateMode('cell')
}else
myDataProcessor.setUpdateMode('off')
document.getElementById('updatebutton').style.display=state?'none':'inline';
document.getElementById('updatemodes').style.display=state?'':'none'
}
var toRef;
Answer posted by Support on Jul 30, 2008 02:46
The next line , will check value in 3rd column
>> myDataProcessor.setVerificator(3,checkIfNotZero);
but your grid has only two columns - which cause issue.

Just remove both setVerificator lines, if you not need them