Performance advice: how to cache or activate?
I load my form panel with a listener, here is an example:
listeners:{
'activate': {
fn:loadForm,
scope:this
}
}
The loadForm function looks like this:
function loadForm(form){
switch (form){
case myform: // name of the form
form.getForm().load({
url:'data.ashx?a=2',
method:'post',
waitMsg:'Loading...'
})
break;
// ...
Everything works fine, but I think it can be optimized. :-?
Each time I activate the form the form loads the data from the server. How can I prevent a reload? I could not find any cache attribute...
Thanks!
Then I was saying you could call for loading of your form from an onRender event so the form is only loaded when it's rendered.
Your present format seems to resemble a factory pattern?
Okay, it looks like this does the job (tested with Firebug). Thank you.
I know what xtype is. I did not knew that there was a discussion about this issue. I will take a search about that.
About the factory pattern... I don't know about definitions... foreach form I create a var. When I want to display a form, then I use the var inside a for example a tabpanel. When forms have the same functionality then I add that functionality inside a separate function.
Thanks again.
Thanks for your reply.
How do you want to use an xtype?
I have taken a search about the onrender event and could not find an appropriate example of how to use this event in extjs/javascript syntax. I hope you can provide me a code example. Thanks again!
#If you have any other info about this subject , Please add it free.# |





