在面板内创建内部零部件



我在这里有工作代码:在容器内创建两个不同的面板:

Ext.application({
    requires: ['Ext.container.Viewport'],
    name: 'AM',
    appFolder: 'app',
    controllers: [
        'Users'
    ],
      launch: function() {
        Ext.create('Ext.panel.Panel', {
            renderTo: Ext.getBody(),
            width: 900,
            height: 600,
            title: 'The Panel',
            layout: { 
            type: 'hbox'
            },
            items: [
                { xtype: 'panel', padding: 5, height: 500, width: '35%' },
                { xtype: 'userlist', padding: 5, height: 500, width: '65%' },
            ],
            listeners: {
                render: function() {
                  console.log('The Panel was rendered');
                }
            }
        });
    }

我想做的是能够在左侧面板中放置不同的组件(即组合框、输入框等)。我如何做到这一点,创建这些组件的最佳实践是什么?(所有东西都应该放在app.js中吗?)

您正在查找items配置属性。将其用作添加子组件的数组:

{
    xtype: 'panel',
    items: [
        { xtype: 'combo' }
    ]
}

你会想看看文档,如果你计划大量使用ExtJS框架,这是你需要知道的非常基本的信息:http://docs.sencha.com/extjs/4.2.1/#/引导/组件

最新更新