Cancelling a selection?
First of all, nice work!
My task at hand is to do some verification if the user selects another row, and if the verification fails I will need to cancel that selection, basically revert to the selected row prior to the user click. I tried putting that in the "selectionChanged" function, but it gives me a "stack overflow". Here's my code. Any help would be appreciated!
var bCancelClick=false; //a flag I set in an attempt to avoid infinite loop
function showDetail(src){
if (parent.mainFrame.bDirty){
//this is the verification, basically a flag I put in the other frame
if (!confirm("You have not saved the changes you made. By loading another record you will lose these changes. Do you want to drop your changes and move on to another record?")) {
bCancelClick=true;
return;
}
}
var sid=src.getProperty("row/index")
parent.mainFrame.location="wsheetdetail.cfm?schedule_id=" + sid.toString()
}
function cancelClick(){
if (bCancelClick){
obj.setSelectionIndex(parent.mainFrame.iSID); //this is the index before the click
bCancelClick=false;
}
}
obj.setAction("selectionChanged", cancelClick);
obj.setAction("click", showDetail);
My task at hand is to do some verification if the user selects another row, and if the verification fails I will need to cancel that selection, basically revert to the selected row prior to the user click. I tried putting that in the "selectionChanged" function, but it gives me a "stack overflow". Here's my code. Any help would be appreciated!
var bCancelClick=false; //a flag I set in an attempt to avoid infinite loop
function showDetail(src){
if (parent.mainFrame.bDirty){
//this is the verification, basically a flag I put in the other frame
if (!confirm("You have not saved the changes you made. By loading another record you will lose these changes. Do you want to drop your changes and move on to another record?")) {
bCancelClick=true;
return;
}
}
var sid=src.getProperty("row/index")
parent.mainFrame.location="wsheetdetail.cfm?schedule_id=" + sid.toString()
}
function cancelClick(){
if (bCancelClick){
obj.setSelectionIndex(parent.mainFrame.iSID); //this is the index before the click
bCancelClick=false;
}
}
obj.setAction("selectionChanged", cancelClick);
obj.setAction("click", showDetail);
chocobo
January 23,