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?
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
}
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: