ExtJS 5 从对象创建动态面板

ExtJS 5 create dynamic panel from object

假设我有对象

var obj = {
  xtype: 'panel',
  title: 'other panel'    
}

我想从中获取动态面板。 我想要这样的东西:

var obj = {
      xtype: 'panel',
      title: 'other panel'    
    }
var panel = Ext.create(obj); //not work of course

然后绑定事件

panel.on('added', function(){console.log('hello world'});

怎么可能?

尝试使用 Ext.widget,例如:

var panel = Ext.widget(obj.xtype, obj);