码迷,mamicode.com
首页 > Web开发 > 详细

EXTJS 3.0 资料 控件之 combo 用法

时间:2014-12-31 12:58:43      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:

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 }));//插入到最后一行  
                            }
                        }
                    }
                }
            }
            ]
        }

 

EXTJS 3.0 资料 控件之 combo 用法

标签:

原文地址:http://www.cnblogs.com/foreverfendou/p/4195399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!