From 67f8a9c87ca327619d3469aaae4bc1b0da441628 Mon Sep 17 00:00:00 2001 From: Jens Klaer Date: Tue, 27 Oct 2015 16:58:50 +0100 Subject: calling replace on clientside will now either replace the whole element (like before) or optionally just replace its content this is needed for TJuiDialog (maybe for other jqueryui controls too) because if the element (in case of TJuiDialog the div panel) will be replaced, jqueryui will clean up by calling destroy on dom element removal causing the replaceWith to fail because the parent node is already removed when replacing the original element with the new content. to avoid this, only the inner content will be replaced which is now controlled by an optional parameter for the clientscript replace method. --- framework/Web/Javascripts/source/prado/prado.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'framework/Web/Javascripts') diff --git a/framework/Web/Javascripts/source/prado/prado.js b/framework/Web/Javascripts/source/prado/prado.js index ec7f68fc..01c0d630 100644 --- a/framework/Web/Javascripts/source/prado/prado.js +++ b/framework/Web/Javascripts/source/prado/prado.js @@ -525,8 +525,9 @@ Prado.Element = * @param {string|element} element - DOM element or element id * @param {optional string} content - New content of element * @param {optional string} boundary - Boundary of new content + * @param {optional boolean} self - Whether to replace itself or just the inner content */ - replace : function(element, content, boundary) + replace : function(element, content, boundary, self) { if(boundary) { @@ -534,7 +535,10 @@ Prado.Element = if(result != null) content = result; } - jQuery('#'+element).replaceWith(content); + if(self) + jQuery('#'+element).replaceWith(content); + else + jQuery('#'+element).html(content); }, /** -- cgit v1.2.3