如何使用两个extjs组合框组成一个新组件?

时间:2013-02-20 19:16:09

标签: extjs extjs4

我必须使用两个组合框,第一个组合框选择类别,第二个组合框在第一个组合框中设置的类别中进行搜索。我想将它们打包在一起成为一个新组件(有自己的xtype等)。我该怎么做?

2 个答案:

答案 0 :(得分:0)

Ext.define('DoubleCombo', {
    extend: 'Ext.Panel', // or Ext.Component e.t.c
    alias: 'widget.doubleCombo',
    items: [{
        xtype: 'combobox',
        ...
    },{
        xtype: 'combobox',
        ...
    }]
});

你可以使用xtype:'doubleCombo'。 有关组件,请参阅本指南:http://docs.sencha.com/ext-js/4-1/#!/guide/components

答案 1 :(得分:0)

Ext.define('MyApp.view.MyContainer', {
    extend: 'Ext.container.Container',
    alias:'widget.myxtype',

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [
                {
                    xtype: 'combobox',
                    fieldLabel: 'Label'
                },
                {
                    xtype: 'combobox',
                    fieldLabel: 'Label'
                }
            ]
        });

        me.callParent(arguments);
    }
});
相关问题