Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by GR on Jun 06, 2008 08:19
open dhtmlx forum
Dataprocessor stop working

I got a grid control defined with a dataprocessor. The grid content change everytime that users change selection on a combobox (common combo, not dhtml). Im using this code to redefine the grid:
function BuildGrid(code){
//grid def
if (typeof(mygrid) != "undefined"){
mygrid.destructor();
mygrid=new dhtmlXGridObject('gridbox');
} else {
mygrid=new dhtmlXGridObject('gridbox');
}
mygrid.setEditable(true);
mygrid.setImagePath("js/dhtmlx/dhtmlxGrid/codebase/imgs/");
mygrid.enableColumnAutoSize(true);
mygrid.attachEvent("onEditCell",onEditCell);
mygrid.setOnLoadingStart(ProgreesBar);
mygrid.setOnLoadingEnd(HideProgress);
mygrid.loadXML("gethandler.php?areaTB=" + code);

//dataprocessor def
if (typeof(myDataProcessor) == "undefined") {
myDataProcessor = new dataProcessor("savehandler.php?uid=" + new Date().valueOf() + "&areaTB=" + code);
myDataProcessor.setUpdateMode("off");
myDataProcessor.setVerificator(3);
myDataProcessor.setVerificator(4);
myDataProcessor.init(mygrid);
} else {
myDataProcessor = new dataProcessor("savehandler.php?uid=" + new Date().valueOf() + "&areaTB=" + code);
}
}

the first load, the grid and dataporcessor work without problems, but when the buildgrid function is called again, dataprocessor stop working. Am I missing something? is this the correct way to redefine my grid? I need to use this kind of reload beacuse my grid uses split and footer.
Answer posted by Support on Jun 06, 2008 09:57
In case of "split" mode the grid can't be reloaded without recreation - so your code is mostly correct.
The second part, which recreates dataprocessor, miss command, which will attach new dataprocessor to the new grid
    } else {
    myDataProcessor = new dataProcessor("savehandler.php?uid=" + new Date().valueOf() + "&areaTB=" + code);
    myDataProcessor.init(mygrid); // this line missed
    }