-
1 Mar 2012 2:35 PM #1
Unanswered: Created custom xtype resulted to Uncaught Error
Unanswered: Created custom xtype resulted to Uncaught Error
I created a tab panel and this is found in app.js. In one of the items I have this
Code:{ xtype: 'homepanel' },
in my Home.js, i also have this for view
and this for the controllerCode:Ext.define('Sencha.view.Home', { extend: 'Ext.Panel', xtype: 'homepanel', config: { title: 'Home', iconCls: 'home', cls: 'home', html: 'Home', html: [ '<h1>Title', '<p>Description</p>' ].join("") }
The console is able to log the 'inited' so the connection to the controller is established. However, there is an error and is says:Code:Ext.define('Sencha.controller.Main', { extend: 'Ext.app.Controller', views: ['Home'], init: function() { console.log('inited'); } });
Uncaught Error: [Ext.createByAlias] Cannot create an instance of unrecognized alias: widget.homepanel
What have I done wrong?
Thanks for your help.
-
1 Mar 2012 8:29 PM #2
Ext.define('Sencha.view.Home', {
extend: 'Ext.Panel',
//xtype: 'homepanel',
alias: 'widget.homepanel', // its xtype when you use it, not when you define it.
-
1 Mar 2012 11:49 PM #3
-
2 Mar 2012 10:42 AM #4
That's the way I do it and it works for me.
-
2 Mar 2012 1:20 PM #5
I was actually following the video tutorials from here to the letter
http://docs.sencha.com/touch/2-0/#!/video/mvc-part-1
but i got stuck in this line. I am using the RC2 version. Any suggestions why mine does not work?
-
2 Mar 2012 1:23 PM #6
your app.js needs to have views: ['Home']
something like this
everything else looks fine, xtype should work i dont think you need to switch to alias and I don't think you need views:['Home'] in the controllerCode:Ext.Loader.setConfig({ enabled: true }); Ext.application({ name: 'My App', models: [], stores: [], views: ['Home'], controllers: [], launch: function () { Ext.create('myApp.view.Viewport'); } });
-
4 Mar 2012 2:16 AM #7
I also have this problem, following all the steps with Ed Spencer presentation on SenchaCon 2011 and keep getting this error, I am using Sencha Touch 2.0 RC2, everything works fine so I know i am settin up project fine, only XTYPE: is throwing error? Can enybody look at this code, what are we doing wrong so we keep getting this error?

-
5 Mar 2012 6:19 AM #8
-
8 Mar 2012 1:01 PM #9
A very simple mistake. I forgot to include the home.js in my index.html. Thank you all anyway.

-
8 Mar 2012 2:19 PM #10
I'm getting the same problem
I'm getting the same problem
I'm trying to follow along with the video tutorial on http://docs.sencha.com/touch/2-0/#!/...etting_started, and the error happens (for me), when he gets to 5:15. I've rewatched the previous 1-2 minutes about 10 times, can't figure out what I'm doing wrong.On Win 7 64-bit.


Reply With Quote
