ext 简单 json定义 combo

Ext.ux.ComboBox = function(config) {
    
if (Ext.isArray(config.store)) {
            
var store = [];
            
for (var i = 0, len = config.store.length; i < len; i++)
                store[i] 
= [config.store[i]];
            config.store 
= new Ext.data.JsonStore({
                        fields : [
'valuefield''displayfield'],
                        data : config.store
                    });
            config.valueField 
= 'valuefield';
            config.displayField 
= 'displayfield';
    }
    Ext.ux.ComboBox.superclass.constructor.call(
this, config);
}
Ext.extend(Ext.ux.ComboBox, Ext.form.ComboBox, {

});
Ext.reg(
'comboux', Ext.ux.ComboBox);

 

 

用法:

 

{width:"233",store:[{valuefield:"1",displayfield:""},{valuefield:"2",displayfield:""},{valuefield:"3",displayfield:"李宇春} ],allowBlank:false
                    ,fieldLabel:
"性别",mode:"local",xtype:"comboux",readOnly:true,displayField:"displayfield",valueField:"valuefield"
                    ,name:
"gm",triggerAction:"all",hiddenName:'gm'} 

 

posted @ 2009-08-21 13:04  meetrice  阅读(950)  评论(0编辑  收藏  举报