EXTJS 3.0 资料 控件之 combo 用法

EXTJS combo 控件:

1.先定义store

//年款
var comboData_ReleasYear = [
     [0, 2010],
     [1, 2011],
     [2, 2013],
     [3, 2014]
];

2.定义combo控件

{
            layout: form,
            labelWidth: 50,
            width: 260,
            items: [{
                xtype: combo, name: ReleasYear, allowBlank: false,
                fieldLabel: 年款, width: 150,
                store: new Ext.data.SimpleStore({
                    fields: [Id, Name],
                    data: comboData_ReleasYear
                }),
                valueField: "Id",
                displayField: "Name",
                mode: local,
                editable: false,
                triggerAction: all,
                allowBlank: false,
                autoload: true,
                listeners: {
                    select: function (combo, record, index) {                   
                        var ReleasYear = PKUPanelForm.form.findField(ReleasYear).getRawValue();
                        if (ItemStorePKU.getCount() == 0) {
                            ItemStorePKU.insert(0, new ItemStorePKU.recordType({ ReleasYear: ReleasYear }));//插入到最后一行
                        } else {
                            for (var i = 0; i < ItemStorePKU.getCount() ; i++) {
                                ItemStorePKU.insert(i, new ItemStorePKU.recordType({ ReleasYear: ReleasYear }));//插入到最后一行  
                            }
                        }
                    }
                }
            }
            ]
        }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。