Sencha Touch:如何在hbox面板中创建列表

时间:2013-02-07 21:00:39

标签: javascript mobile extjs sencha-touch sencha-touch-2

我有一个导航视图,其中包含一个tabview,我想在其中添加一个cboxnains并列出的hbox面板和另一个面板。但是,当我尝试将列表添加到面板时,没有任何显示。我想知道如何做到这一点 enter image description here 导航视图

Ext.define('MyApp.view.Navigation', {
    extend: 'Ext.navigation.View',
    id: 'NavView',
    xtype: 'navigationcard',
    onBackButtonTap: function () {
        //if on forms screen and button is visible remove add form button
        var self = Ext.getCmp('NavView');
        var naviBtn = Ext.getCmp('addNewFormBtn');
        if (naviBtn != null) {
            naviBtn.hide();
        }
        self.pop();
    },
    config: {
        title: 'Schedule',
        iconCls: 'settings',
        navigationBar: {
            items: [{
                xtype: 'button',
                text: 'Add New Form',
                align: 'right',
                id: 'addNewFormBtn',
                hidden: true,
                handler: function () {

            }
            }]
        },
        //we only give it one item by default, which will be the only item in the 'stack' when it loads
        items: [
                   {
                       xtype: 'mainview'
                   }
        ]
    }
});

标签面板

Ext.define('MyApp.view.Main', {
    extend: 'Ext.TabPanel',
    xtype: ['mainview', 'widget.mainview'],
    config: {
        title:'MyApp',
        fullscreen: true,
        tabBarPosition: 'bottom',
        defaults: {
            styleHtmlContent: true
        },
        items: [
            contain ,
            { xtype: 'settingscard' }
        ]
    }

});

具有Hbox和列表的面板

var testData = [];
for (var i = 0; i < 40; i++)
{ testData.push({ txt: "test" }); }

var storesdasd = Ext.create('Ext.data.Store', {
    data: testData
});

var contain = Ext.create('Ext.Panel', {
    fullscreen: true,
    layout: 'hbox',
    title: 'Schedules',
    iconCls: 'time',
    items: [{
        xtype: 'list',
        itemTpl: '{txt}',
        store: storesdasd,
        flex: 1,
        height: 'auto'
    }

    , {
        html: 'message preview',
        style: 'background-color: #759E60;',
        flex: 2,
        height: '100'
    }],
    config: {
        title: 'Schedules',
        iconCls: 'time'
    }
});

2 个答案:

答案 0 :(得分:1)

不是将所有这些部分分别放在不同的文件中,而是将它们放在Ext.application的启动功能中,这似乎有效,尽管不确定原因。

答案 1 :(得分:0)

使用:

layout: {
    type: 'hbox',
    align: 'stretch'
}

删除子项目的高度配置。同时删除包含面板上的全屏配置。

相关问题