ITeye博客

EXTJS3 简易下拉框 easyCombo

atgoingguoat · 2010-09-01 10:34 · js · Web前端 · Markdown

EXTJS 简易下拉框 easyCombo

一个自己拓展的简单下拉框

 

/**
 *简易下拉框

*/
Ext.ux.EasyCombo = Ext.extend(Ext.form.ComboBox, {
    initComponent: function() {
        this.readOnly = true;
        this.displayField = 'mc';
        this.valueField = 'id';
        this.triggerAction = 'all';
        this.mode=this.mode;
        this.store=this.store;
     this.forceSelection= true;
        this.editable=false;
        this.emptyText='请选择...';
        Ext.ux.EasyCombo.superclass.initComponent.call(this);
    }
});
Ext.reg('easyCombo', Ext.ux.EasyCombo);

前台调用:

 

,{
                     xtype:'easyCombo',
                     fieldLabel: '<span style="color:red;">* </span>收费方式',
                     hiddenName:'payModeNo',
                     allowBlank:false,
                     store : payModeNoStore,
                     value: 11,
                     mode: 'local'
}

评论(7)

  1. #7 楼 · caleb_520 · 2010-09-08 08:38

    楼主能不能附件加上截图了。这样子新手也不知道这段代码到底是用来干什么的

  2. #6 楼 · x03570227 · 2010-09-04 15:03

    你的继承没意义

    fieldLabel: '* 收费方式' 掺杂html代码,没有统一风格 用样式代替 itemCls:"required", allowBlank:false,

    楼主最好去看看this是干嘛用的

    一个有用的继续应该像下面这样写 Ext.example.MyCombo = Ext.extend(Ext.form.ComboBox, { constructor:function(config){ config=config||{}; Ext.apply(this,config); var c={ //继承后,新对象的一些默认配置 }; Ext.example.MyCombo.superclass.constructor.call(this,c); }, myFn:function(){ //新对象的一些新方法 } });

    如果不是非常常用,不必添加到自定义xtype,直接new即可,如: var combo = new Ext.example.MyCombo({ //一些必要的配置,如id项 });

  3. #5 楼 · liuzk86 · 2010-09-04 10:02

    这个,靠,晕死,这个叫简易.....

  4. #4 楼 · joeyhacker · 2010-09-04 08:04

    太死板了, 至少留个fields可以自订吧, store就别要了

  5. #3 楼 · Sean220 · 2010-09-03 16:34

    和2L一样没看出哪里简易了

  6. #2 楼 · sunliao_first · 2010-09-03 15:20

    你这种应该算是特定功能下的扩展吧

  7. #1 楼 · qiu768 · 2010-09-03 10:14

    没看出比原生的combo简易到哪去。。。。。

评论功能维护中,当前仅展示历史评论。