Author: michiel
Date: 2010-03-17 13:43:54 +0100 (Wed, 17 Mar 2010)
New Revision: 41463

Modified:
   
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
Log:
did that fixe a bit different

Modified: 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
===================================================================
--- 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
        2010-03-17 12:30:47 UTC (rev 41462)
+++ 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/List.js.jsp
        2010-03-17 12:43:54 UTC (rev 41463)
@@ -202,6 +202,7 @@
     // Before the page is left, we need to save. Arrange that here.
     $(window).bind("beforeunload",
                    function(ev) {
+                       List.prototype.leftPage = true;
                        var result = self.commit(0, true);
                        if (result != null) {
                            ev.returnValue = confirm(result); //'<fmt:message 
key="invalid" />';
@@ -696,11 +697,9 @@
 List.prototype.commit = function(stale, leavePage) {
     var result;
     var self = this;
-    if (this.saving) {
-        // already saving right now
-        return;
-    }
-    if(this.needsCommit() && ! List.prototype.leftPage) {
+    if(this.needsCommit() && (! List.prototype.leftPage || leavePage)) {
+        // if triggered unload prototype.leftPage is true, so normal commits 
are cancelled. But the last 'leavePage' (which will happen asynchronously)
+        // does proceed. This is because we want this last commit to delay 
actually leaving the page.
 
         if (this.valid) {
             var now = new Date();

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to