gogagubi
gogagubi

Reputation: 1015

ExtJS 5 create dynamic panel from object

lets say I have object

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

And I want to get dynamic panel from it. I want something like this:

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

and then bind event

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

how It possible?

Upvotes: 3

Views: 114

Answers (1)

CD..
CD..

Reputation: 74096

Try using Ext.widget instead, like:

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

Upvotes: 3

Related Questions