赋值"/>
EXT combobox赋值
Ext.combobox对象在通过setValue赋值时,必须在combobox对象的store对象中存在该值,否则无法赋值。
事例:
{
xtype: 'fieldcontainer',
combineErrors: true,
msgTarget : 'side',
id:'module_container_id',
layout: 'hbox',
defaults: {
flex: 1,
allowBlank: false,
labelWidth : 90
},
items: [{
xtype : 'textfield',
fieldLabel:'所属模块',
name:'module_name',
id:'module_name',
allowBlank : true,
maxLength:300
},{
xtype:'button',
id:'cpczscbtn',
text:'选择模块',
flex:0.3,
handler:function(){
showBaselineSelector(coczscCallback,true);
}
}]
},
function coczscCallback(records){
var name = '';
var id = '';
var module_version = '';
Ext.Array.each(records,function(r){
name = name + r.data.module_name + r.data.module_version;
id = id + r.data.p_module_content_id;
module_version = r.data.module_version;
});
pBug_form.getForm().findField('module_name').setValue(name);
pBug_form.getForm().findField('p_task_id').setValue(id);
versionComboStore.add({text:module_version , value:module_version});
Ext.getCmp('task_version1').setValue(module_version);
pBug_form.getForm().findField('module_name').setReadOnly(true);
}
var versionComboStore = Ext.create("Ext.data.Store",{
fields: ['text', 'value'],
proxy:{ //数据代理
type: 'ajax',
method: 'POST',
reader: {//读取器
type: 'json'
}
},
autoLoad:false
});
更多推荐
EXT combobox赋值
发布评论