EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: zhenghacn on September 03, 2014, 10:16:57 PM



Title: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 03, 2014, 10:16:57 PM
I have a issue for DOM object release.

my index.html as following

<body>
    <div id="content_area">
        <div id="workspace"> </div>
    </div>


the working page will load into workspace as following code:
$("#workspace").load("newdatebox.html", null, function(){$.parser.parse("#workspace");});

Fox example, there is a datebox in newdatebox.html

Once load newdatebox.html, there will generate a DOM object in root of DOM tree which class is "panel combo-p", and this DOM will be never released. this means, there will be couple of "panel combo-p" DOMs after repeated load newdatebox.html.

please help me figure out the reason and fix this issue.

The code and snapshot for DOM tree please refer to attachment.


Title: Re: the DOM of datebox panel DO NOT release
Post by: stworthy on September 04, 2014, 12:49:17 AM
Please try to use the 'refresh' method of panel to load external page.
Code:
<div id="workspace" class="easyui-panel"> </div>
Code:
$('#workspace').panel('refresh','newdatebox.html');


Title: Re: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 05, 2014, 01:23:02 AM
It works, thanks a lot.


Please try to use the 'refresh' method of panel to load external page.
Code:
<div id="workspace" class="easyui-panel"> </div>
Code:
$('#workspace').panel('refresh','newdatebox.html');


Title: Re: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 10, 2014, 01:19:13 AM
hi stworthy,
i met another problem, the DOMs which class="panel window" and class="window-shadow" will not be released automatically when the panel is refreshed.

i use following code as you mentioned:
$('#workspace').panel('refresh','xxx.html');

please give me suggestion. thanks a lot.

Please try to use the 'refresh' method of panel to load external page.
Code:
<div id="workspace" class="easyui-panel"> </div>
Code:
$('#workspace').panel('refresh','newdatebox.html');


Title: Re: the DOM of datebox panel DO NOT release
Post by: stworthy on September 10, 2014, 01:34:19 AM
the DOMs which class="panel window" and class="window-shadow" will not be released automatically when the panel is refreshed.

Please describe your question in more detail.


Title: Re: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 10, 2014, 06:46:03 PM
Dear stworthy,
I attached the index.html and test.hmtl, there are only a easyui-dialog in test.hmtl.

if test.hmtl is loaded multiple times, the DOMs which class is "panel window" and "window-shadow" will be not released automatically, there will be many garbage DOMs in the root of DOM tree.

Please correct me the right way to use easyUI. Thanks a lot.


Title: Re: the DOM of datebox panel DO NOT release
Post by: stworthy on September 10, 2014, 07:19:18 PM
You have to destroy the dialog object manually.


Title: Re: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 10, 2014, 07:36:13 PM
is there no way to destory dialog object automatically or some workarround?

You have to destroy the dialog object manually.


Title: Re: the DOM of datebox panel DO NOT release
Post by: stworthy on September 10, 2014, 08:26:29 PM
You have to recognize what dialogs are loaded by yourself. You can add a 'cls' property to them, so that you can find them easily and do further operations for them.


Title: Re: the DOM of datebox panel DO NOT release
Post by: zhenghacn on September 11, 2014, 07:22:03 PM
Thanks for your response.
I think that does NOT make sense to handle Dialog. Could your team enhance the Dialog to use it easy?

You have to recognize what dialogs are loaded by yourself. You can add a 'cls' property to them, so that you can find them easily and do further operations for them.