CRM-16117 - Fix content disappearing when ajax paging
authorColeman Watts <coleman@civicrm.org>
Mon, 16 Mar 2015 15:39:46 +0000 (11:39 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 16 Mar 2015 15:39:46 +0000 (11:39 -0400)
js/crm.ajax.js

index 7c22c3ddd97a8e9abdef8bc4df6b9a501cf3ead3..02a4a6312b041409efbeed994bee7c78a40864a0 100644 (file)
       var that = this;
       var url = this._formatUrl(this.options.url);
       if (this.options.crmForm) $('form', this.element).ajaxFormUnbind();
-      if (this._originalContent === null) {
-        this._originalContent = this.element.contents().detach();
-      }
       if (this.options.block) this.element.block();
       $.getJSON(url, function(data) {
         if (that.options.block) that.element.unblock();
     // Perform any cleanup needed before removing/replacing content
     _beforeRemovingContent: function() {
       var that = this;
+      // Save original content to be restored if widget is destroyed
+      if (this._originalContent === null) {
+        $('.blockUI', this.element).remove();
+        this._originalContent = this.element.contents().detach();
+      }
       if (window.tinyMCE && tinyMCE.editors) {
         $.each(tinyMCE.editors, function(k) {
           if ($.contains(that.element[0], this.getElement())) {