Hi,
In my loadState function, I'm setting the current page to where the user last let off. This works fine, except that the first survey page is displayed initially, than after a small but perceptible lag, the desired page is painted.
Is there any way to pause the screen paint, until the desired page is loaded?
Here's my loadState function for your reference:
JavaScriptfunction loadState(survey, isInitialLoad = false) {
//Here should be the code to load the data from your database
var xhr = new XMLHttpRequest();
xhr.open("GET", "/Survey/Survey/SurveyData", true);
xhr.responseType = "json";
// - Send Anti-Forgery Token (otherwise a BAD REQUEST ERROR (400) will be returned)
xhr.setRequestHeader("XSRF-TOKEN", $('input:hidden[name="__RequestVerificationToken"]').val());
xhr.send();
xhr.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var surveyResponse = this.response;
survey.clear(); // Clear the survey state
survey.data = surveyResponse.data; // Load data
if (isInitialLoad) {
survey.currentPageNo = surveyResponse.currentPageNo; // Set survey page to where user left off
}
} else {
//error or not ready
}
}
}
Thanks,
Alan