Not sure if it is the right approach but I moved the setValue isViewLoading into the http_request and after it has added the entries to the dom .
mobileControls.js
var nextEntryNumber = parseInt(getValue(nextEntry, getViewStateIndex(viewItemsId)));
http_request.open("GET", databaseAndViewName + "?ReadViewEntries" + categoryFilter + "&Start=" + nextEntryNumber + "&Count=" + getValue(amountEntriesToBeRead, getViewStateIndex(viewItemsId)) + "&OutputFormat=JSON", true );
http_request.onreadystatechange = function () {
if (http_request.readyState == 4 && http_request.status == 200) {
if (nextEntryNumber == 1) {
if (enableOffline == true) {
localStorage.setItem("MobileControlsView", http_request.responseText);
}
}
addViewEntriesIntoDOM(viewItemsId, http_request.responseText, false, true, targetPageName, targetUrl, transition, enableOffline, offlineDocumentPath, columnNumber);
setValue(isViewLoading, getViewStateIndex(viewItemsId), "false");
}
};
http_request.send(null);
}
prog.stop();
// setValue(isViewLoading, getViewStateIndex(viewItemsId), "false");
}