Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Lina on Dec 05, 2007 14:54
open dhtmlx forum
ajax time

ajax needs time to save or update data so you can't do so many steps at once like check 10 checkboxes one time it doesn't work ?any solutaion?
Answer posted by Support on Dec 06, 2007 02:44
>> it doesn't work ?
Can you please describe which problem exactly occurs for you.
In case of dataProcessor usage all modification synced with server, even if in current moment some other data in syncing process, changes will not be lost, dataProcessor will create additional request to save data.

Other strategy is not syncing data automatically but call dataProc.sendData() when all necessary modification will be applied to grid.

Answer posted by Lina on Dec 06, 2007 08:36

Thank you very much,

i don't use dataProcessor  but what i am doing is:

  1. i am calling doOnCellEdit 
  2. and in this method i do loadXML(aspfile)   and this  asp file does the database action(insert,update,delete) and offcurse i pass the parameters ( action_type and if it is  update i pass which fields have to be changed)
  3. what is not working with all this that i have to add a delay function because this ajax(loadxml(aspfile))  takes time  ,if i didn't add delay you can't do anything on the grid like check another checkbox.
  4. so my problem is that i don't know how much time i have to delay it or if there is another way to solve this?.

i hope i was clear enough ,and thank you very much again.

 

 

 

Answer posted by Support on Dec 06, 2007 10:20
You can lock grid for some time, there is no such thing as constant delay, but you can use onLoadingEnd handler to detect moment when XML loaded ( which mean operation finished )

function my_lock(){
    window.setTimeout(function(){
        grid.setEditable(false);
    },1);
}

function my_unlock(){
        grid.setEditable(true);
}

function doOnCellEdit (...){
    if (some_rule){
        my_lock();
       grid.loadXML(aspfile,my_unlock) // will be unlocked on data loadindg
    }
}