0

hey i was wondering about the following problem a long time: In my previous app i specified an xtype to my classes like so:

Ext.define('Sencha.view.Home', {
extend: 'Ext.Panel',
xtype: 'homepanel', 

then in my Viewport i added in the items the xtype of 'homepanel' and of course this worked fine and the homepanel and others were displayed in my view. But after upgrading to 2.0 final i can't do this anymore? No i have to use it like this to include my homepanel in the view:

xclass: 'Sencha.view.Home'

Was this a change in the version? Do i now always must call the xclass, or am i doing something wrong with my xtype? Thanks for help!

Phil
  • 182
  • 1
  • 4
  • 16
  • can you also show how your project is configured? How the controllers and stores are set up, because this should not be needed. – adis Mar 09 '12 at 08:44

5 Answers5

1

The Sencha Framework has an alias keyword instead of xtype for the declaration http://docs.sencha.com/touch/2-0/#!/api/Ext.Class-cfg-alias

Ext.define('MyApp.CoolPanel', {
    extend: 'Ext.panel.Panel',
    alias: ['widget.coolpanel'],
    title: 'Yeah!'
});

// Using Ext.create
Ext.widget('widget.coolpanel');
// Using the shorthand for widgets and in xtypes
Ext.widget('panel', {
    items: [
        {xtype: 'coolpanel', html: 'Foo'},
       {xtype: 'coolpanel', html: 'Bar'}
    ]
});

Which is also how EXTJS does it nowadays: https://stackoverflow.com/a/5608766/330417

Community
  • 1
  • 1
Alex
  • 5,674
  • 7
  • 42
  • 65
  • i tried this in my Home view: ´alias: 'widget.homepanel' and i called it in my Mainview with ´alias: 'homepanel´ but it shows nothing :/ – Phil Mar 09 '12 at 14:14
  • you would be using it as xtype:homepanel, but declaring it as alias – Alex Mar 14 '12 at 09:36
0

just change your container to list from panel and set the list-config as

 scrollable: false,
 pinHeaders: false,
antyrat
  • 27,479
  • 9
  • 75
  • 76
Bhavin Bathani
  • 190
  • 1
  • 12
0

I have a Sencha Touch 2.0 app and my viewport is set up like this:

Ext.define('example.view.Viewport', {
    extend: 'Ext.Container',
    config: {
        fullscreen: true,
        id: 'mainContainer',
        layout: {
            type: 'card',
            animation: {}//we manually set this throughout the app
        },
        items: [
            /*
             * This is a list of all of the "cards" in our app that are preloaded
             */
            { xtype: 'dashboardpanel' },
            { xtype: 'customerlist' },
            { xtype: 'loginpanel' }
        ]
    }
});

So if yours isn't working I'm guessing something else is going on. But its hard to tell without seeing more code.

jb1785
  • 722
  • 1
  • 7
  • 19
0

So i figured out what was wrong with my xtypes: I declared my Views in my Controller not in my App.js, as i had put them into my app.js all worked fine for me! Thanks for your help!

Phil
  • 182
  • 1
  • 4
  • 16
0
Ext.define('Sencha.view.Home', {
extend: 'Ext.Panel',
alias: 'widget.homepanel'

when you want to use the alias widget 'homepanel' you just say xtype:'homepanel wherever you want to implement it

fuzzyLikeSheep
  • 473
  • 3
  • 10