Sencha Touch 2 xtype not working as expected

Go To StackoverFlow.com

1

SO I am building my first Sencha Touch App and I am having a problem with rendering a Panel that I have defined.

Login.js

Ext.define("Blog.view.Login", {
  extend:'Ext.form.Panel',
  requires : ['Ext.form.FieldSet', 'Ext.field.Email', 'Ext.field.Password'],
  xtype: 'loginpanel',

  config:{
    scrollable:true,
    title: "Log In",

    items:[
      {
        html:"<center><h1>OkShit</h1></center>",
        styleHtmlContent:true
      },
      {
        xtype:'fieldset',
        items:[
          {
            xtype:'emailfield',
            name:'email',
            placeHolder:'E-Mail'
          },

          {
            xtype:'passwordfield',
            name:'password',
            placeHolder:'Password'
          }
        ]
      },
      {
        xtype:'button',
        text:'Log In',
        style:{
          marginBottom:'20px'
        }
      },
      {
        xtype:'button',
        text:'Sign Up'
      }
    ]
  }

});

Main.js

Ext.define("Blog.view.Main", {
  extend:'Ext.Container',

  config:{
    items:[
      {
        xtype :'loginpanel'
      }
    ]
  }
});

app.js

views: ['Main', 'Login'],

I did some research already and someone suggested to use

alias: 'widget.loginpanel'

I tried it but it still did not work. Does anyone have any solution to this?

EDIT This is what I have right now and it is still not doing anything =(

Ext.define("Blog.view.Login", {
  extend:'Ext.form.Panel',
  alias: 'widget.loginpanel',
  requires : ['Ext.form.FieldSet', 'Ext.field.Email', 'Ext.field.Password'], ...
2012-04-04 04:47
by denniss
alias: 'widget.loginpanel' works for me, check for spelling and capitalization mistakes, id also place it before requires not that it should matte - Adam Marshall 2012-04-04 05:28


3

Basically, it's not really necessary to use alias because you've already defined that class and registered it with a xtype in Sencha Touch 2.

Which browser are you using? Please see if there are any errors logged in browser debugger and paste here. I will try to help you out.

2012-04-04 06:14
by Thiem Nguyen
thanks for the reply. there is no error and I am using Chrome for thi - denniss 2012-04-04 06:18
I've modified a little bit your source code and it works fine. Take a look to the two configs, it did the tricks. xD `Ext.define("Blog.view.Main", { extend:'Ext.Container',

config:{ fullscreen: true, layout: 'card', items:[ { xtype :'loginpanel' } ] } }); - Thiem Nguyen 2012-04-04 06:38

awesome! i need the layout: 'card' - denniss 2012-04-04 06:44
congratulation x - Thiem Nguyen 2012-04-04 06:51
Ads