2012-11-09 81 views
1

我正在使用具有一套手風琴的面板說第一個孩子,第二個孩子,第三個孩子。手風琴佈局混亂

我發現當面板已經實例化的第一個孩子

會自動展開。但是當我刪除第一個孩子時,手風琴佈局面板不能自動展開孩子。

對不起我的英語不好而表達不清,有人可以幫助並弄明白

var firstChild ={ 
     id:'first', 
     title: 'first child', 
     html: 'first child' 
    }; 


var acc= Ext.create('Ext.panel.Panel', { 
    title: 'Accordion layout', 
    width: 300, 
    height: 300, 
    layout:'accordion', 
    defaults: { 
     bodyStyle: 'padding:15px' 
    }, 
    layoutConfig: { 
     titleCollapse: false, 
     animate: false, 
     activeOnTop: true, 
     collapseFirst:true 
    }, 
    items: [ 
     firstChild, 
     { 
     title: 'second child', 
     html: 'second child' 
    },{ 
     title: 'third child', 
     html: 'third child' 
    }], 
    renderTo: 'demo' 
}); 


acc.remove(Ext.getCmp("first")); 

刪除後的第一個孩子,不能自動展開子

新用戶不得發表圖片,這裏是地址

http://i.stack.imgur.com/im848.jpg http://i.stack.imgur.com/E1ze7.jpg

回答

0

您可以算了筆ELL它擴大:

Ext.onReady(function() { 

    var acc = Ext.create('Ext.panel.Panel', { 
     title: 'Accordion layout', 
     width: 300, 
     height: 300, 
     layout: 'accordion', 
     defaults: { 
      bodyStyle: 'padding:15px' 
     }, 
     layoutConfig: { 
      titleCollapse: false, 
      animate: false, 
      activeOnTop: true, 
      collapseFirst: true 
     }, 
     items: [{ 
      id: 'first', 
      title: 'first child', 
      html: 'first child' 
     }, { 
      title: 'second child', 
      html: 'second child' 
     }, { 
      title: 'third child', 
      html: 'third child' 
     }], 
     renderTo: document.body 
    }); 

    acc.remove('first'); 
    acc.items.first().expand(); 

}); 
+0

非常感謝你 – user1811060

+0

它的效果很好,而且操作簡單 – user1811060