当前位置: 动力学知识库 > 问答 > 编程问答 >

extjs4 - How to display panel on click event of menu?

问题描述:

I would like to know how to display certain panel on click event of menu? I have added menu items in viewport and listening for 'click' event of menu items in controller. Upto this point its working fine but when I use Ext.widget() method to get panel and call show() method of that panel, nothing is happening.

My code to handle menu item click event is as follows :

viewPortMenu_ClickHandler : function(menu, item, event, options) {

var panelToShow = null;

if (item.text == '4D view') {

panelToShow = Ext.widget('employeeDistribution');

}

if (panelToShow != null) {

panelToShow.show();

}

}

Please let me know why this is not working / what is the preferred way to display panels at runtime?

网友答案:

I found the answer. I just had to add the newly created panel inside viewport using add() method of viewport.

分享给朋友:
您可能感兴趣的文章:
随机阅读: