PDA

View Full Version : latency with Ext.create ?



brigot
29 Apr 2013, 12:19 AM
Hello,

Currently I am faced with a problem of response time. When I am on a grid, I have add a context menu for open a window. this windows contain many items : tabs, form, google map, ...

this 'object' is initialized at the initialisation of the page like this :



var winform = null, ............
Ext.onReady(function() {
.......
winform = Ext.create('hippo.winform', { ........ });
.......

and it is declarate like this :


Ext.define('hippo.winform', {
win : null
,form : null
....
,config :
{
....
}

,constructor: function(config)
{
.....
this.form = Ext.create('Ext.form.Panel', { .... } );
....
this.win = Ext.create('Ext.window.Window', { .... } );
....
}
....
});

and this.win contain a tabpanel and one tab is a border layout using for region center this.form

but whenever I want to open the window, I have to wait 3 seconds before use it ....

for show and load the form, i have a function "show", it load the record on the form, show the window, change title of the window, enable or disable some button, ....

but if i delete all and keep only on the "show" function


this.win.show();

it take allway 3 sec ... why ? ?
i use extjs 4.1.3

in some other apps, i havent use the " Ext.create( " and just a script like this :


var apps = {
win : null
,........

,init : function(config)
{
......
apps.win = Ext.create('Ext.window.Window', { .......... });

}
.....
,show : function()
{
apps.win.show();
.......
}
....
};


with this, open a window is instant, and dont wait 3 sec ...

is it normal ?
am I a design error or did I not understand the functioning of Ext.create ?

evant
29 Apr 2013, 1:07 AM
Ext.create() will send an ajax request to pull in any classes it needs when you call it.

Make sure you've used Ext.require() at the start to pull everything in.

You'll see on the console it will log() to tell you that it's loading stuff dynamically.

brigot
29 Apr 2013, 6:19 AM
hello again,

i think the probleme is not realy with Ext.create, but with


winform.show();


like my first post, this function contain only :


this.win.show();

other part are comment for this moment

just for try, i have change small "rule"
in the "constructor", i create an id


this.id_window = config.id_window || Ext.id('','window_');

and after, i use this for declare this.win


this.win = Ext.create('Ext.window.Window', {
...
,id : this.id_window
...
});


now, when i call the "winform.show()" i have this :


,show : function(input)
{
...
if( Ext.get(this.id_window) == null )
{ // first show
this.win.show();

this.load_data();
}else
{
Ext.get(this.id_window).dom.style.display = '';

this.load_data();
}
}

and i add a listeners to the window like this :



,listeners :
{
scope : this
,beforehide : function()
{
Ext.get(this.id_window).dom.style.display = 'none';

return false;
}
}


with this solution, when i want show the form, the first time, it allway 3 sec, but after, it load instant without freeze !

i dont know how make better .... for accelerate the show ...
Thank in advance