`
atgoingguoat
  • 浏览: 190710 次
  • 性别: Icon_minigender_1
  • 来自: 长沙
社区版块
存档分类
最新评论

EXTJS3 简易下拉框 easyCombo

    博客分类:
  • js
 
阅读更多

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 楼 caleb_520 2010-09-08  
楼主能不能附件加上截图了。这样子新手也不知道这段代码到底是用来干什么的
6 楼 x03570227 2010-09-04  
你的继承没意义

fieldLabel: '<span style="color:red;">* </span>收费方式'
掺杂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项
});
5 楼 liuzk86 2010-09-04  
这个,靠,晕死,这个叫简易.....
4 楼 joeyhacker 2010-09-04  
太死板了, 至少留个fields[]可以自订吧, store就别要了
3 楼 Sean220 2010-09-03  
和2L一样没看出哪里简易了
2 楼 sunliao_first 2010-09-03  
你这种应该算是特定功能下的扩展吧
1 楼 qiu768 2010-09-03  
没看出比原生的combo简易到哪去。。。。。

相关推荐

Global site tag (gtag.js) - Google Analytics