1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    5
    Vote Rating
    0
    CCExp is on a distinguished road

      0  

    Default Making an accordion element refresh its layout when expanded

    Making an accordion element refresh its layout when expanded


    Does anyone know how to call doLayout() on an item when it is expanded? I have an application where there's an accordion element containing several formpanels. These formpanels have composite fields that don't render on the non-expanded formpanels, but I can make them render by using the form's doLayout() function. I have tried adding this property to the form using the onExpand property:

    Code:
    Ext.form.CalcFormPanel = Ext.extend(Ext.form.FormPanel, {
        labelWidth: 75,
        bodyStyle:'padding:5px 5px 0',
        border:false,
        onExpand: function() {
            this.doLayout();
        },
        width: 280,
        defaults: {width: 80},
        forceLayout: true,
        defaultType: 'textfield'
    });
    But this causes my form not to work and throws JS error messages. Does anyone know how I can cause the doLayout() function to fire whenever a given form in the accordion is expanded? Thanks for any help.

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,169
    Vote Rating
    28
    jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough jay@moduscreate.com is a jewel in the rough

      0  

    Default


    You can't add arbitrary members to a class and expect the class to call it.

    Code:
    Ext.form.CalcFormPanel = Ext.extend(Ext.form.FormPanel, {
        labelWidth: 75,
        bodyStyle:'padding:5px 5px 0',
        border:false,
        initComponent: function() {
            Ext.form.CalcFormPanel.superclass.initComponent.call(this);
            this.on('expand', this.doLayout, this);
        },
        width: 280,
        defaults: {width: 80},
        forceLayout: true,
        defaultType: 'textfield'
    });

    Jay Garcia @ModusJesus || Modus Create co-founder
    Ext JS in Action author
    Sencha Touch in Action author

    Get in touch for Ext JS & Sencha Touch Touch Training

    We are also working on Video-based Sencha Touch training: Check it out here.

Similar Threads

  1. [RESOLVED] No expanded item accordion layout
    By senacle in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 2 May 2010, 11:52 PM
  2. [RESOLVED] No expanded items in accordion layout
    By senacle in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 25 Mar 2010, 12:35 AM
  3. Way to keep at least one panel in an accordion layout always expanded?
    By Gjslick in forum Ext 2.x: Help & Discussion
    Replies: 16
    Last Post: 8 Mar 2010, 2:51 PM
  4. Ext2.0 accordion load content on accordion expanded
    By ectalk in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 Oct 2007, 8:10 PM
  5. [Ext 2.0] - Making a div accordion
    By undefined in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 30 Aug 2007, 7:58 AM

Tags for this Thread