Ext.js5表单,表格—(等级,评级)小部件(45)

view

/**
 * Demonstrates the rating widget in a form and grid column.
 * 在表和网格中使用rating widget
 */
Ext.define('KitchenSink.view.form.RatingForm', {
    extend: 'Ext.panel.Panel',
    xtype: 'form-rating',
    //基于Ext.ux的类扩展
    requires: [
        'Ext.ux.rating.Picker'
    ],

    title: 'Rating Form',
    //这是啥意思?20151221
    viewModel: true,

    bodyPadding: 10,
    width: 520,
    height: 500,
    minHeight: 400,
    resizable: true,
    frame: true,
    layout: {
        type: 'vbox',
        align: 'stretch'
    },
    defaultType: 'textfield',

    items: [{
        xtype: 'grid',
        flex: 1,
        reference: 'employeeGrid',
        store: {
            type: 'big-data'
        },
        margin: '0 0 10 0',
        columns:[{
            xtype: 'rownumberer',
            width: 40,
            sortable: false
        }, {
            text: 'Id',
            sortable: true,
            dataIndex: 'employeeNo',
            groupable: false,
            width: 80
        }, {
            text: 'Name',
            sortable: true,
            dataIndex: 'name',
            groupable: false,
            flex: 1
        },{
            text: 'Rating',
            columns: [{
                xtype: 'widgetcolumn',
                text: 'Last Year',
                width: 100,
                dataIndex: 'ratingLastYear',
                widget: {
                    xtype: 'rating',
                    overStyle: 'color: orange;'
                }
            },{
                xtype: 'widgetcolumn',
                text: 'This Year',
                width: 100,
                dataIndex: 'ratingThisYear',
                widget: {
                    xtype: 'rating',
                    selectedStyle: 'color: rgb(96, 169, 23);',
                    overStyle: 'color: rgb(23, 23, 189);',
                    tooltip: [
                        '<div style="white-space: nowrap;"><b>',
                            'Current: {[this.rank[values.value]]}',
                        '</b>',
                        '<tpl if="trackOver && tracking !== value">',
                            '<br><span style="color:#aaa">(click to set to ',
                            '{[this.rank[values.tracking]]}',
                            ')</span>',
                        '</tpl></span>',
                        {
                            rank: {
                                1: 'Probation',
                                2: 'Needs Improvement',
                                3: 'Valued Contributor',
                                4: 'Excellent',
                                5: 'Rock Star'
                            }
                        }
                    ]
                }
            }]
        }]
    },
    //将表格的值绑到表单上
    {
        fieldLabel: 'First Name',
        emptyText: 'First Name',
        bind: {
            disabled: '{!employeeGrid.selection}',
            value: '{employeeGrid.selection.forename}'
        }
    }, {
        fieldLabel: 'Last Name',
        emptyText: 'Last Name',
        bind: {
            disabled: '{!employeeGrid.selection}',
            value: '{employeeGrid.selection.surname}'
        }
    }, {
        fieldLabel: 'Email',
        vtype: 'email',
        bind: {
            disabled: '{!employeeGrid.selection}',
            value: '{employeeGrid.selection.email}'
        }
    }, {
        xtype: 'datefield',
        fieldLabel: 'Date of Birth',
        allowBlank: false,
        maxValue: new Date(),
        bind: {
            disabled: '{!employeeGrid.selection}',
            value: '{employeeGrid.selection.dob}'
        }
    }, {
        xtype: 'fieldcontainer',
        fieldLabel: 'Current\u00a0Rating',
        bind: {
            disabled: '{!employeeGrid.selection}'
        },
        items: [{
            xtype: 'rating',
            scale: '150%',
            bind: '{employeeGrid.selection.ratingThisYear}'
        }]
    }]
});
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值