简体   繁体   中英

Ext.Panel items is not rendering properly

I declared a Navigation view:

Ext.define('MyApp.view.Main', {
extend: 'Ext.navigation.View',
alias: 'widget.mainNavigationView',

requires: [
    'Ext.TitleBar',
    'MyApp.view.Home'
],
config: {
    tabBarPosition: 'top',
    navigationBar: {
        id: 'mainNavBar',
        ui: 'dark',
        items: [{
            xtype: 'button',
            id: 'logoutUser',
            text: 'Logout',
            align: 'right',
            hideAnimation: Ext.os.is.Android ? false : {
                type: 'fadeOut',
                duration: 200
            },
            showAnimation: Ext.os.is.Android ? false : {
                type: 'fadeIn',
                duration: 200
            }
        }]
    },

    items: [
        {
            xtype: 'homePage'
        },

    ]
  }
});

And the home page panel:

Ext.define('MyApp.view.Home', {
extend: 'Ext.Panel',
alias: 'widget.homePage',

config: {
    title: 'Menu Principal',
},

items: [
    {
        store: {
            fields: ['listItem'],
            data: [
                {listItem: 'Item 1'},
                {listItem: 'Item 2'},
                {listItem: 'Item 3'},
                {listItem: 'Item 4'}
            ]
        },

        itemTpl: '{listItem}'
    }
  ],
});

My problem is that the list (homePage Ext.Panel 's item) is not rendering, I don't know exactly why. Any thoughts from guru guys? I'm just starting with sencha-touch and Ext .

You have a few problems with your home page panel:

  • The 'items' section is outside the 'config'
  • The xtype of the list is not set to 'list'
  • The panel is missing a layout

     Ext.define('MyApp.view.Home', { extend: 'Ext.Panel', alias: 'widget.homePage', config: { title: 'Menu Principal', layout: 'fit', items: [ { xtype: 'list', store: { fields: ['listItem'], data: [ {listItem: 'Item 1'}, {listItem: 'Item 2'}, {listItem: 'Item 3'}, {listItem: 'Item 4'} ] }, itemTpl: '{listItem}' } ] } }); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM