Model view controller 要传递的ExtJS菜单参数
我正在创建一个带有动态菜单的ExtJS MVC应用程序。我有几个菜单元素,它们将调用同一屏幕(在布局中设置活动卡),但每次都需要传递不同的值作为参数。因此,一张卡可以根据用作过滤器的参数显示不同的数据 我的菜单元素有一个单击侦听器:Model view controller 要传递的ExtJS菜单参数,model-view-controller,extjs,menu,Model View Controller,Extjs,Menu,我正在创建一个带有动态菜单的ExtJS MVC应用程序。我有几个菜单元素,它们将调用同一屏幕(在布局中设置活动卡),但每次都需要传递不同的值作为参数。因此,一张卡可以根据用作过滤器的参数显示不同的数据 我的菜单元素有一个单击侦听器: listeners: { itemclick: function(view, record, item, index, e){ Ext.getCmp('contentpanel').layout.setActiveItem(record.getId(
listeners: {
itemclick: function(view, record, item, index, e){
Ext.getCmp('contentpanel').layout.setActiveItem(record.getId());
}
}
记录Id将是我设置为活动的卡。
如何将参数传递给卡 如果需要,您可以向面板添加另一个属性。例如:
Ext.define('YourApp.view.YourCardPanel' ,{
extend: 'Ext.panel.Panel',
id: 'contentpanel',
alias : 'widget.yourcardpanel',
layout: 'card',
newParam: null, // Just to know that this attribute exists but there is no need to declare it.
items: [],
changeLayout: function(){
if (this.newParam == 'new value') {
// Do your stuff
}
}
});
然后你可以改变这个参数的值
listeners: {
itemclick: function(view, record, item, index, e){
var cardPanel = Ext.getCmp('contentpanel');
cardPanel.newParam = 'new value';
cardPanel.changeLayout();
cardPanel.layout.setActiveItem(record.getId());
}
}