ExtJs Accordion布局下监听点击Panel事件

由于Accordion只是应用于Panel的一种布局,因此没有专门的事件。这里通过监听子Panel的expand的事件来达到类似监听点击Panel事件的效果。

代码如下:

 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 });

 

效果图:

 
当点击左侧按钮展开子菜单面板时,弹出提示框,说明监听成功。
posted @ 2013-11-26 10:06  流于人间的氓  阅读(2703)  评论(0编辑  收藏  举报