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'
}
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项
});