在实际项目使用中为了方便combo的使用,扩展了下combo
Ext.ns("Miracle.form")
Miracle.form.ComboBox=Ext.extend(Ext.form.ComboBox,{
typeAhead : true,
mode : 'remote',
forceSelection : true,
triggerAction : 'all',
emptyText : '',
selectOnFocus : true,
displayField : 'name',
valueField : 'code',
hideTrigger : false,
queryDelay : 500,
url:'',
idProperty:'code',
fields:['code', 'name'],
getStore :function(){
this.store=new Ext.data.JsonStore({
idProperty : this.idProperty,
url : this.url,
fields : this.fields
})
},
constructor : function(config) {
Ext.apply(this,config);
if(!this.store){
this.getStore();
}
Miracle.form.ComboBox.superclass.constructor.call(this);
}
})
Ext.reg("miraclecombox",Miracle.form.ComboBox);
?
使用时
new Miracle.form.ComboBox({
???? ??url :'你的URL',
??fieldLabel : 'label',
??hiddenName : 'name'
?})
?