I’m having difficulty understanding how to initiate the busy plugin. It seems like there is no call to it in the actual looping method, so how then does it get called? What if I have many looping methods on the same form?
When I try to run this, it drops into the catch. If I take out the plugin calls, the method itself reverts to working.
Thank you,
Don
I created this global method,
function UTIL_startBusy(activeFunction, messageText, cancelBtnText, dialogName) {
if(activeFunction) {
var params = {
processFunctionName: activeFunction,
opacity: 0.5,
paneColor: '#000000',
textColor: '#FF0000'
}
if(messageText) {
params.message = messageText;
}
if(cancelBtnText) {
params.showCancelButton = true;
params.cancelButtonText = cancelBtnText;
}
if(dialogName) {
params.dialogName = dialogName;
}
plugins.busy.block(params);
}
}
onShow for base form (where the loop is located),
function onShow_browse_form(firstShow, event) {
var recs = 0;
if(firstShow == true) {
if (application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT) { // 7.31.2012
plugins.busy.prepare();
}
vBrowseWelcome = 'Welcome ' + current_user_to_user_info.usr_user_name + ' / ' + current_selpa_to_system_settings.sys_selpa_name;
if(current_user_to_user_info.usr_privilege_level) {
if(current_user_to_user_info.usr_privilege_level.match(/administrator/i)) {
vBrowseWelcome += " (administrator)";
} else if(current_user_to_user_info.usr_privilege_level.match(/teacher/i)) {
vBrowseWelcome += " (teacher/provider)";
} else if(current_user_to_user_info.usr_privilege_level.match(/read-only/i)) {
vBrowseWelcome += " (read only)";
}
}
forms.browse_form.elements.tabs_150.dividerLocation = 130; // this is the *horizontal* divider from the left tab panel
onAction_studentsTab(event); // default is to students browse
} else { // not firstShow
browse_vBrowseInfo_set(); // change the record display at form bottom, as needed
}
}
Here is the looping method, on the base form (Reader’s Digest condensation),
function browse_complianceTimeline() {
// This calls a dialog where the user selects options for the loop. When the
// user clicks on OK, the dialog script destroys its own window, and calls browse_complianceTimeline2 (below).
var win = application.createWindow("complTimeDlg",JSWindow.MODAL_DIALOG);
win.title = "Compliance timeline...";
win.show("complianceCalcBatch_dlg");
}
function browse_complianceTimeline2() {
// (define variables and get preferences from browse_complianceTimeline dialog
recs = databaseManager.getFoundSetCount(fsStd);
if(recs == 0) {
tempText = "Could not find any eligible students, for whom to calculate compliance. "
globals.UTIL_alertDlg(tempText,"Compliance timeline...",null);
} else {
try {
application.updateUI();
globals.UTIL_startBusy(forms.browse_form.browse_complianceTimeline2,"Calculating compliance...","Cancel",null);
var aProblems = new Array();
for(i = 1 ; i <= recs ; i++) { // for each student
// validate and process each record; there are a second set of "j" loops in this section
if (plugins.busy.isCanceled()) {
studentErrorText = fsStd.std_record_number + " - " + fsStd.std_name_last + ", " + fsStd.std_name_first + " (user cancel on this student, no further evaluations)."
aProblems.push(studentErrorText);
break;
}
} // loop for each student
} catch (e) {
failText = "Could not complete search for student compliance (contact administrator).";
} finally {
plugins.busy.unblock();
}