I have two function, one function is a reload function that does a ajax web call to get data. the other is the item loader that loads the data. The problem is that the function that loads the data item has not value yet because of the ajax call made. Anyway of fixing this besides calling setTimeout? Thanks in advance for any help.
function reload(index) {
_ListData[index] = null;
DisplayInformation.GetTemplateTableInformation(
ListManager.listReportId(),
ListManager.listParameters(),
ListManager.listSortParams(),
TableReportHelper_TemplateRelatedAction,
reloadRange.min,
reloadRange.num,
function(templateItemIfo) {//success callback causes issues with race conditon in the function itemLookaheadCallback because _ListData[index] = null;
itemLookaheadCallback(templateItemIfo, index);
});
}
Here is the function that tries to load the item that was called in the reload callback
function loadDataCallback(lookAheadData, index, loadNeighbors) {
//Store the received value
var item = _ListData[index];//this will be null because of _ListData[index] = null;
item.data = lookAheadData.TemplateInformation;
};