Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Udhayabalachandar on May 02, 2008 00:16
open dhtmlx forum
Cannot Clear the Grid

I am doing Edit the cell and Save the record using Data processor...

function save(){
    myDataProcessor.sendData()
    document.getElementById("idData").value = "Updated";
    mygrid.clearAll(true);
    mygrid.loadXML("sms/update.jsp?action=get_data",function(){
     mygrid.setColumnHidden(2,true);
     mygrid.setColumnHidden(3,true);
     mygrid.setColumnHidden(4,true);
});

}

I call like this

after that the javascript Error message is shown
this.getRowById(row_id).style.fontWeight is null or not an object

What should be the problem...
Please suggest some solution

Thanks and Regards
Udhayabalachandar
Answer posted by Support on May 02, 2008 04:24
The saving is async. process.
In your code snippet , you are clearing grid before saving finished, so the code fails.
The correct code will look similar to next

function save(){
    myDataProcessor.setOnAfterUpdate(function(){
       if (myDataProcessor.getSyncState()) after_save();
    });
    myDataProcessor.sendData()
};
function after_save(){
    document.getElementById("idData").value = "Updated";
    mygrid.clearAll(true);
    mygrid.loadXML("sms/update.jsp?action=get_data",function(){
     mygrid.setColumnHidden(2,true);
     mygrid.setColumnHidden(3,true);
     mygrid.setColumnHidden(4,true);
};