• Home
  • Performance advice: how to cache or activate?

  • Hi,

    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!


  • I don't understand your response. Do you understand xtype? There is a tutorial discussion on it's use, advantages, etc.

    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?


  • Basically instead of 'activate' maybe you want 'render'?

    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.


  • How about creating an xtype and inside maybe the onrender event you call for the load?


  • How about creating an xtype and inside maybe the onrender event you call for the load?

    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!


  • Basically instead of 'activate' maybe you want 'render'?







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Performance advice: how to cache or activate? , Please add it free.