1. #1
    Ext User
    Join Date
    Aug 2007
    Posts
    9
    Vote Rating
    0
    goalmac is on a distinguished road

      0  

    Question Accordion Rendering Problem - items array

    Accordion Rendering Problem - items array


    Hello,

    Can anyone tell me how to do it dynamically? Thanks.

    Original:
    Code:
                var itemArray = new Array();
    
                itemArray[0] = new Ext.Panel({
                    title: 'Accordion Item 1',
                    html: '<empty panel>',
                    cls:'empty'
                });
    
                itemArray[1] = new Ext.Panel({
                    title: 'Accordion Item 2',
                    html: '<empty panel>',
                    cls:'empty'
                });
    
                itemArray[2] = new Ext.Panel({
                    title: 'Accordion Item 3',
                    html: '<empty panel>',
                    cls:'empty'
                });
    
                itemArray[3] = new Ext.Panel({
                    title: 'Accordion Item 4',
                    html: '<empty panel>',
                    cls:'empty'
                });
    
                var accordion = new Ext.Panel({
                    region:'west',
                    margins:'5 0 5 5',
                    split:true,
                    width: 210,
                    layout:'accordion',
                    items: [itemArray[0], itemArray[1], itemArray[2], itemArray[3]]
                });
    The numbers of item in 'itemArray' is varied. I would like to code dynamically like this.
    Code:
                var accordion = new Ext.Panel({
                    region:'west',
                    margins:'5 0 5 5',
                    split:true,
                    width: 210,
                    layout:'accordion',
                    items: [itemArray]
                });
    Error prompts for 'header' is null or not an object. Any idea or solution?

    Thanks for your help.

    Regards,
    GM

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,507
    Vote Rating
    56
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Think about it.

    The items config should be an Array

    itemArray is an Array


    ?

  3. #3
    Ext User
    Join Date
    Aug 2007
    Posts
    9
    Vote Rating
    0
    goalmac is on a distinguished road

      0  

    Default


    ic. Thanks.

Thread Participants: 1