PDA

View Full Version : Problem with simple subclassing



Eric.Sencha
12 Jan 2012, 11:36 AM
Hello,

I am trying out some simple subclassing but i bomb out whenever i subclass two levels deep.

I think i am missing something fundamental about extjs4 subclassing.

Ext.ns('MyApp');

Ext.define('MyApp.BaseClass',
{
extend: 'Ext.Panel',
xtype: 'x-panel-myapp-base-class'
});

Ext.define('MyApp.FirstClass',
{
extend: 'MyApp.BaseClass',
xtype: 'x-panel-myapp-first-class'
});

Ext.define('MyApp.SecondClass',
{
extend: 'MyApp.BaseClass',
xtype: 'x-panel-myapp-second-class'
});

Ext.application(
{
name: 'MyApp',
...

mitchellsimoens
12 Jan 2012, 12:12 PM
You don't need to do the Ext.ns, Ext.define will make sure the namespace is available.

What's the trouble? Simple code like you provided should work no problems.

Eric.Sencha
12 Jan 2012, 12:45 PM
Mitchell,

Please see the attached files for particulars.

I changed the "xtype" to "alias" as per a post on ExtJS4 i found
(http://stackoverflow.com/questions/5380770/replacing-ext-reg-xtype-in-extjs4)

Thanks,

-Eric

mitchellsimoens
12 Jan 2012, 12:46 PM
ah... yes, skipped over that... xtype is not a valid property but alias is.

Eric.Sencha
12 Jan 2012, 12:47 PM
It seems to still fail to render even with alias instead of xtype