Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Aran Deltac on Nov 07, 2008 14:02
open dhtmlx forum
DataProcessor Delayed Cell Update

Hello,

I've just implemented the dataprocess on my grid and it works great. I'm using the cell-update mode where it automatically updates the instant a cell is changed.

My users tend to update several dozen cells quickly which means several dozen calls to the server to store the changes over a very short period of time (a couple seconds). Is there any way to add an automatic delay so that multiple rows can be updated in a single server request, but still use the automatic cell update feature?

This ability would allow for the ease of use that the cell updates provide, but reduce the load on the server. I would think that it would be much sought after by other dhtmlx users.

Thanks,

Aran
Answer posted by Support on Nov 10, 2008 01:52
Can be done as

var dp = new dataProcessor(some);
dp.link(mygrid);
dp.setTransactionMode("POST",true);

var dp_timer;
var dp_allowed=false;
dp.setOnBeforeUpdateHandler(function(){
        if (dp_allowed) return true;
        if (dp_timer) window.clearTimeout(dp_timer); 
        dp_timer=window.setTimeout(function(){
                   dp_allowed=true;
                   dp.sendData();
                   dp_allowed=false;            
         },3000);
         return false;
})

With such code, dataprocessor will send update only after user stops active grid editing.