因爲Accordion只是應用於Panel的一種佈局,所以沒有專門的事件。這裏經過監聽子Panel的expand的事件來達到相似監聽點擊Panel事件的效果。ide
代碼以下:佈局
1 new Ext.Panel({ 2 width: 225, 3 region : 'center', 4 layout: 'accordion', 5 layoutConfig: { 6 titleCollapse: true, 7 animate: false, 8 activeOnTop: false, 9 hideCollapseTool: true 10 }, 11 items : [{ 12 iconCls : moduleSetCss, 13 id : moduleSetId, 14 title: moduleSetText, 15 items : configItemPanel, 16 listeners : { 17 'expand' : function(p) { 18 alert("expand:" + p.getId()); 19 } 20 } 21 },{ 22 iconCls : moduleSetCss2, 23 id :moduleSetId2, 24 title: moduleSetText2, 25 items : configItemPanel2, 26 listeners : { 27 'expand' : function(p) { 28 alert("expand:" + p.getId()); 29 } 30 } 31 }] 32 });
效果圖:spa