Cache panel content

  1. #1

    Cache panel content

    Hi,

    I am trying to show an accordion with various panels inside. For the time being I am loading the single panel contents when the panel is expanded. Problem is that this content is loaded every time it is expanded and not only the first time. I was wondering if there is a way in ext (.net or JS) to check if the panel already has content or if the load has already happened to avoid continuous round-trips to the server...

    I have also tried to preload the panels content at the page startup, so all the panels will be loaded before usage, but again I wouldn't like to add time to the initial page load, so I used "AutoRender = false" (which actually worked quite well for a window that I used in the past) but nonetheless the panels are all loaded at the start even if they are all collapsed.

    Anyone has any idea on how to solve this, one way or the other? :)

    Regards,
  2. #2
    How do you load content?
  3. #3
    hi Vlad,

    in both cases I load using MVC, so for the js example I have defined a function that I fire onExpand:
    function expand(pnl) {
                 pnl.load({
                    url: '/MyModel/Details/' + pnl.id.split('_').pop(),
                    params: { containerId: function () { return pnl.body.id } },
                    showMask: true,
                    scripts: true
                });
            }
    this works ok as I said but it loads every time I expand the panel, while I would like to do it only the first time.

    In the second example I tried something like this:
    var pnl = new Ext.Net.Panel(model.Name)
                                {
                                    ID = "model_" + model.Id,
                                    Collapsible = true,
                                    Collapsed = true
                                };
                pnl.AutoLoad.Url = "/MyModel/Details/" + model.Id;
                pnl.AutoLoad.Params.Add(new Ext.Net.Parameter("containerId", pnl.ID));
                pnl.AutoRender = false;
                
                this.MyPanel.Items.Add(pnl);
    with the hope that AutoRender=false would stop the client to load the panel from the server if it was hidden from view, but this is not the case.

    Regards,
  4. #4
    Set Animate=false for accordion layout
  5. #5
    Also, i guess you have to set Single=true for expand event
  6. #6
    HI Vlad,

    Animate=false does not seem to solve any of the problems, but "Single=true" does indeed prove a good solution (I should probably read the doc a bit more deeper I realize now) ;)

    Thanks for your time again!
  7. #7
    Animate=false can be required if you use IFrame mode for autoload (under non IE browsers)

Similar Threads

  1. Replies: 0
    Last Post: Jul 26, 2011, 4:57 PM
  2. Refresh ext:Panel content
    By reiben in forum 1.x Help
    Replies: 3
    Last Post: Mar 29, 2011, 5:01 PM
  3. Tab Panel Content Loading
    By xMAC in forum 1.x Help
    Replies: 5
    Last Post: Dec 10, 2010, 7:07 AM
  4. Panel Content Location
    By fpw2377 in forum 1.x Help
    Replies: 2
    Last Post: Aug 05, 2010, 8:08 PM
  5. Print content inside a panel
    By Nagaraj K Hebbar in forum 1.x Help
    Replies: 0
    Last Post: May 19, 2009, 2:14 AM

Tags for this Thread

Posting Permissions