Ext.js5文本域的自我复制(fieldreplicator插件)(31)

/**
 * This example illustrates the use of plugins to alter the default behaviour of Components.
 * The <b>Send To</b> field clones itself until the final one is left blank to allow
 * multiple mail recipients. The layout manager keeps the vertical space allocated correctly.
 * 这个例子使用了插件去修改组件的默认行为。Send To 文本域会复制本身,直到最后一个为空白的,这样可以填写多个邮件接收者(不过这个设计真是汗颜。。。。)。布局管理器保持垂直空间正确分配。
 */
Ext.define('KitchenSink.view.form.FieldReplicator', {
    extend: 'Ext.form.Panel',
    xtype: 'form-fieldreplicator',


    title: 'Compose message',
    width: 400,
    frame: true,
    bodyPadding: 5,
    resizable: true,
    minHeight: 200,

    fieldDefaults: {
        labelWidth: 70,
        anchor: '100%'
    },

    layout: {
        type: 'vbox',
        align: 'stretch'  // Child items are stretched to full width
    },

    items: [{
        xtype: 'container',
        scrollable: true,
        maxHeight: 100,
        layout: 'anchor',
        items: [{
            xtype: 'combo',
            store: {
                type: 'array',
                fields: [ 'email' ],
                data: [
                    ['test@example.com'],
                    ['someone@example.com'],
                    ['someone-else@example.com']
                ]
            },
            displayField: 'email',
            plugins: 'fieldreplicator',
            fieldLabel: 'Send To',
            anchor: '0',
            queryMode: 'local',
            //是否Tab键可以选择当前突出项。
            selectOnTab: false,
            name: 'to',
            onReplicate: function () {
                this.getStore().clearFilter();
            }
        }]
    }, {
        xtype: 'textfield',
        fieldLabel: 'Subject',
        name: 'subject'
    }, {
        xtype: 'textarea',
        fieldLabel: 'Message text',
        emptyText: 'Message goes here',
        hideLabel: true,
        name: 'msg',
        flex: 1  // Take up all *remaining* vertical space (kicks in when resized)
    }]
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值