dhtmlxGrid: multiple calls to loadXML: callback not called

Hi,

say i have the following code:

var aGrid = new dhtmlXGridObject();

function refreshRow(rowId)
{
    aGrid.loadXML(url+rowId, function(){callback(rowId);});
}
function callback(rowId)
{
...
}
refreshRow(1);
refreshRow(2);
refreshRow(3);
refreshRow(4);
refreshRow(5);

If i call refreshRow() 5 times, the callback-function is only called 3 or 4 times.
It seems to be some kind of timing problem, it only occurs if one loadXML is still running and the next loadXML is called simultaniously. I fixed this in an ugly way that serializes the function calls, but this cannot be the final solution.

Any thoughts on that issue are appreciated (except “don’t call it 5 times”, in our asynchronous world this just has to work).

hi tofi ,

why can’t u call this function in for loop so, that it can disable for the 5th time

please try this , i think it can solve your problem

i don’t understand - what difference does it make if i call the function 5 times in a row or in a loop?
In my actual program the function is called in a loop…

You may try to modify your function the following way:

function refreshRow(id)
{
dhtmlxAjax.get(url+id, function(loader){
mygrid.parse(loader.xmlDoc.responseXML);
callback(id);
});
}
function callback(id)
{
console.log (id)
}
refreshRow(1);
refreshRow(2);
refreshRow(3);
refreshRow(4);
refreshRow(5);