Hello
I would like to make a copy of the original WebDialog window object before making it visible
// like this
var w = $find('<% =WebDialogWindow1.ClientID %>');
var originalWindow = SomeCloneMethod(w); //I don't know how to do this
var pane = w.get_contentPane();
pane.set_contentUrl('AnotherWindow.aspx');
w.show();
//and then later
.......
w.hide();
w=originalWindow;
I tried all sorts of deep copy functions that I have found in the articles below but all raise "Out of memory"
If somebody can help me, thank you
http://javascript.about.com/od/objectorientedjavascript/a/oop17.htm
http://snipplr.com/view/15407/
http://blog.imaginea.com/deep-copy-in-javascript/
http://james.padolsey.com/javascript/deep-copying-of-objects-and-arrays/
Hi Mateia,
I will review the other forum post as well and I will reply to it.
If you need further assistance do not hesitate to contact me.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://es.infragistics.com/support
Hello Georgi
Thank you very much for taking from your time to help me
All my struggle is actually related to this topic.
http://community.infragistics.com/forums/t/69297.aspx
There is something weird I would like to eliminate.
I reviewed the code provided. In this way I don’t think it is possible to copy this object in the mention approach, using it in this context.
Hello,
Thank you very much but I don't think it works
Please see the code below
Although a deep copy has been made, wBeforeFirstShow.get_contentPane().get_contentUrl(); is not empty....
that means the copy 'wBeforeFirstShow' reflects the changes made upon the original 'w'
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WindowFlicker.Default" %>
<%@ Register assembly="Infragistics4.Web.v11.2, Version=11.2.20112.2086, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.LayoutControls" tagprefix="ig" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head runat="server">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"> </script>
<script type="text/javascript">
var w;
var wBeforeFirstShow = null;
function ShowModalWindow()
{
try {
w = $find('<% =WebDialogWindow1.ClientID %>');
if (!wBeforeFirstShow)
wBeforeFirstShow = jQuery.extend(true, {}, w);
}
alert('ContentURL: ' + wBeforeFirstShow.get_contentPane().get_contentUrl());
catch (e) {
alert("Error in page: " + e.message);
return false;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="z-index: 1; left: 28px; top: 220px; position: absolute; height: 40px;
width: 10px">
<asp:ScriptManager ID="sm1" runat="server">
</asp:ScriptManager>
</div>
<ig:WebDialogWindow ID="WebDialogWindow1" runat="server"
style="z-index: 100; left: 184px; top: 228px; position: absolute; height: 376px; width: 456px;"
Modal="True">
<ContentPane ScrollBars="Hidden">
<Template>
</Template>
</ContentPane>
</ig:WebDialogWindow>
<asp:Button ID="Button1" runat="server"
onclientclick="return ShowModalWindow();"
style="z-index: 1; left: 10px; top: 34px; position: absolute; width: 100px; "
Text="Show window" />
<asp:Label ID="Label1" runat="server"
style="z-index: 1; left: 144px; top: 40px; position: absolute"
Text="Open the modal window, close it and open it again"></asp:Label>
<asp:Label ID="Label2" runat="server"
style="z-index: 1; left: 144px; top: 66px; position: absolute"
Text="The second time the window opens, the content flickers"></asp:Label>
</form>
</body>
</html>
You can try the following ways to do this:
With jQuery
// Shallow copyvar newObject = jQuery.extend({}, oldObject);// Deep copyvar newObject = jQuery.extend(true, {}, oldObject);
Looking forward to hear from you.