Is there an Event for clearAll?

Hello,
i am having code which does this …

id = 1;
data.load("load_dataview.php?q=" + id);
data.clearAll();
id=2;
data.load("load_dataview.php?q=" + id);

I am running into a problem where all data is NOT cleared and hence i have hybrid data from previous load command. Is there a way i can have a event by which i execute the second data.load() ONLY AFTER all data in dataView is cleared?

Thanks

I don’t know of any event for clearAll.

However, you may want to make sure you do not have a cache problem that is causing you to see old data. You can add this to the end of your load call to avoid caching issues:

&etc=' + new Date().getTime()

If that doesn’t work you could build in your own wait loop:

[code]data.load(“load_dataview.php?q=” + id);
data.clearAll();
setTimeout(“isCleared()”, 500); // poll in a half second
data.load(“load_dataview.php?q=” + id);


function isCleared() {
if(data.dataCount() == 0) {
return;
} else {
setTimeout(“isCleared()”, 500); // poll in a half second
}

}[/code]

HTH…

Is there a way i can have a event by which i execute the second data.load() ONLY AFTER all data in dataView is cleared?
load() method works in asynchronous way. You should call clearAll() method after all data is loaded:

data.load("load_dataview.php?q=" + id,function(){ data.clearAll(); });