-
10 Jan 2012 12:17 PM #1
Answered: Custom Panel Types
Answered: Custom Panel Types
I am attempting to create a Tab Panel in which each panel is its own custom type. I have simplified the concept as much as possible, but eventually the custom panel types will have logic and styling rather than just a simple string of html content.
The attached code generates the following error message in Chrome:
Uncaught Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.App.PanelTypeOne
Can someone help me understand why the following does not work using developer preview 3:
Code:Ext.define('App.PanelTypeOne', { extend: 'Ext.Panel', html: 'viewing panel type one' }); Ext.define('App.PanelTypeTwo', { extend: 'Ext.Panel', html: 'viewing panel type two' }); Ext.application({ name: 'Test App', launch: function () { Ext.create("Ext.TabPanel", { fullscreen: true, defaults: { styleHtmlContent: true }, tabBar: { layout: { pack: 'center' }, dock: 'bottom' }, items: [ { xtype: 'App.PanelTypeOne', title: 'Type One', iconCls: 'bookmarks' }, { xtype: 'App.PanelTypeTwo', title: 'Type Two', iconCls: 'info' }, ] }) } });
-
Best Answer Posted by mitchellsimoens
First, your name you specified in Ext.application shouldn't have a space in it.
Second, to create your own xtype, you can simply add the xtype property to you Ext.define call:
One note about xtypes, you can't have periods in them. You should use a different special character like '_' or '-', periods mean something to ComponentQuery.Code:Ext.define('App.PanelTypeOne', { extend : 'Ext.Panel', xtype : 'paneltypeone', config : { html: 'viewing panel type one' } });
-
11 Jan 2012 6:00 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
- Answers
- 3160
First, your name you specified in Ext.application shouldn't have a space in it.
Second, to create your own xtype, you can simply add the xtype property to you Ext.define call:
One note about xtypes, you can't have periods in them. You should use a different special character like '_' or '-', periods mean something to ComponentQuery.Code:Ext.define('App.PanelTypeOne', { extend : 'Ext.Panel', xtype : 'paneltypeone', config : { html: 'viewing panel type one' } });Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.


Reply With Quote