/**
* UserType 用户类别 model 定义
*/
Ext.define('Base.userType.Model', {
extend: 'Ext.data.Model',
scope:this,
fields: [
{name: 'id', type: 'int'}, //该类型为int时,可自动选择,string时需要手动加载
{name: 'typeName', type: 'string'},
{name: 'remark', type: 'string'}
]
});
reader:Ext.create('Ext.data.JsonReader', {
root : "recAll",
model : 'Base.hrManage.Model'
}),
xtype:'combobox',
id:'cmbUserType',
fieldLabel: '用户类别',
labelWidth:60,
editable: false,
store: userTypeStore, //加载store
queryMode: 'local',
displayField: 'typeName',
valueField: 'id',
forceSelection : true,// 必须选择一个选项
name:'userTypeId',
allowBlank: false,
blankText: '请选择类别',
emptyText: '请选择类别',
如果id 为string,加载comboBox则:
var userTypeId = JsonStr.recAll[0].userTypeId.toString(); //须为string类型
Ext.getCmp("cmbUserType").setValue(userTypeId);