为Ext添加下拉框和日期组件

Ext.onReady(function(){
        var config = { fields:['module'],  
                       data:[['新建'],['删除'],['增加']};  
        var store = new Ext.data.SimpleStore(config);  
        var top=new Ext.FormPanel({
            region:'north',
            renderTo:'mainDiv',
            frame:true,
            labelWidth:75,
             920,
            height:90,
            items:[{
                layout:'column',
                items:[{
                    columnWidth:.3,
                    layout: 'form',
                    items: [new Ext.form.ComboBox({
                            id:'user',
                            fieldLabel:'用户',
                            triggerAction:'all', 
                            displayField:'admin',       //定义要显示的字段 
                            forceSelection:true,           //要求输入的值必须在列表中存在
                            resizable:true,                //允许改变下拉列表大小
                            value:'admin',                //默认选择的项    
                            handelHeight:10                //下拉列表中拖动手柄的高度  
                          }),new Ext.form.ComboBox({
                            id:'module',
                            fieldLabel:'操作模块',
                            triggerAction:'all', 
                            store:store,
                            displayField:'module',         //定义要显示的字段 
                            valueField:'module',              //定义值字段  
                            mode:'local',                     //本地模式  
                            forceSelection:true,              //要求输入的值必须在列表中存在
                            resizable:true,                   //允许改变下拉列表大小
                            value:'新建',                   //默认选择的项    
                            handelHeight:10                   //下拉列表中拖动手柄的高度  
                          })
                          
                    ]
                },{
                    columnWidth:.3,
                    layout: 'form',
                    items: [ {id:'STime',
                             name: 'STime',
                             xtype:'datefield',
                             format:"Y-m-d",
                             readOnly:true,
                             fieldLabel: '时间',
                             anchor:'95%'
                          }
                            ,{id:'ETime',
                            name: 'ETime',
                            xtype:'datefield',
                            format:"Y-m-d",
                            readOnly:true,
                            fieldLabel: '至',
                            anchor:'95%'
                          }
                    ]
                },{
                    columnWidth:.1,
                    buttons: [{
                        text: '查询',
                        handler:function(){
                               var module = Ext.getCmp("module").getRawValue();//获取选择操作模块的值
                               var user = Ext.getCmp("user").getRawValue();//获取选择的用户
                               var STime = Ext.getCmp("STime").getRawValue();//查询开始时间
                               var ETime = Ext.getCmp("ETime").getRawValue();//查询开始时间
                               //开始查询日志表
                        }
                    }]
                }]
            }]
        });
    });
下拉框和日期组件
原文地址:https://www.cnblogs.com/zhutouying/p/3250370.html