I have several java script functions that are doing computing intensive stuff on click event or when they are invoked. I am trying to show a spinner/loader when these functions are invoked so that my application looks more responsive then just stuck for 15-20 secs. To solve this I am using LoadingOverlay- http://gasparesganga.com/labs/jquery-loading-overlay/
The problem I am facing is, even after when the loading spinner is shown and the control flow moves to the time/computing intensive calls - the browser freezes and the spinner gif stops spinning thus defeating the whole purpose of application looking responsive. Any help what can I do to solve this and improve the functionality would be great. Thanks
Select: function () {
console.log("--click event of Select button--");
$("#buildSelectionDialog").LoadingOverlay("show");
setTimeout(function(){
var aData = getSelectedRowFromTable('buildsListTable');
if (aData == null) {
alert("No Build Selected.");
return;
}
var selectedBuildName = aData[0];
clearVisitorsEntry(); // View Cache is cleared as build is changing
if ($('#dialogPurpose').val() == "1") {
setApplicationUnderTestBuild(selectedBuildName);
//MOST TIME Consuming STEP --
var autResults = getBuildResultsForTestType(getApplicationUnderTestBuild(), getSelectedTestType());
displayResultsForSelection();
updateRetrievalTimeTooltip(selectedBuildName);
enableAuxiliaryMenusForBuild(selectedBuildName);
}
else{
compareBuilds(selectedBuildName);
}
$("#buildSelectionDialog").LoadingOverlay("hide");
$("#buildSelectionDialog").dialog("close");
}, 500);
}