From 8d6a383065eb52150d3cf0cd7484d7fb57ff398e Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 16 Mar 2015 11:39:46 -0400 Subject: [PATCH] CRM-16117 - Fix content disappearing when ajax paging --- js/crm.ajax.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 7c22c3ddd9..02a4a6312b 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -252,9 +252,6 @@ 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(); @@ -280,6 +277,11 @@ // 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())) { -- 2.25.1