EasyUI Forum
May 02, 2024, 05:42:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Possible High Load to Browser?  (Read 2023 times)
poeziafree
Jr. Member
**
Posts: 69


View Profile Email
« on: March 13, 2022, 09:54:33 AM »

Hello

As I have noticed, creating a new window programmatically, appends the Panel to Body each time the window is created.
Besides, comboboxes and other functionalities are also appended to the the Body, thus storing a huge amount of code in browser console.

I am wondering whether it can affect the speed of the ajax-based website if the user doesn't refresh the page but loads new content dynamically over and over again?

For example this code:

Code:
var win = $('<div id="CreateUserWindow"></div>').appendTo('body');

win.window({
                            title: 'საოპერატორო: მომხმარებლის შექმნა',
                            width: '80%',
                            height: 600,
                            modal: true,
                            resizable: true,
                            closeAnimation: 'hide',
                            minimize: 'animate',
                            collapsible: false,
                            href: false,
                            bodyCls: 'f-column',
                            onMinimize: function() {

                                if (tabPanel.tabs('exists', WindowMinimizeTitle)) {
                                    tabPanel.tabs('select', WindowMinimizeTitle);
                                    return false;
                                }

                                tabPanel.tabs('add', {
                                    id: WindowMinimizeId,
                                    title: WindowMinimizeTitle,
                                    content: '<div id="tabs-window-' + WindowMinimizeId + '" style="position:relative;width:100%;height:100%;overflow:auto"></div>',
                                    fit: true,
                                    closable: true
                                });
                                
                                
                                $('#WindowFooter').contents().appendTo(f);
                                f.appendTo('#tabs-window-' + WindowMinimizeId + '');
                                


                            }
                        });

Each time I create the window using this method, old windows still remain in the console and new windows are added.
Is it ok?

How can I remove the appended code from Body once I close the Window, for example? Is it ok to leave it appended to the Body?

Thank you in advance
« Last Edit: March 13, 2022, 09:57:57 AM by poeziafree » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: March 14, 2022, 04:33:14 PM »

The code below creates only one window. You can call the 'refresh' method to load content from remote, or just replace the content with the jquery native 'html' method.

Code:
var win = $('#CreateUserWindow');
if (!win.length){
var win = $('<div id="CreateUserWindow"></div>').appendTo('body');
win.window({
//...
})
}
win.window('open')
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!