Ext.getCmp()为空或不是对象
我想在下拉框自动填充原有数据,不过数据库里存的是user_id,而要显示的是user_name。所以,我只能先从表里把user_id取出来,再去user表里找user_name.但是我一发请求页面就报错:Ext.getCmp()为空或不是对象。如果我改成文本框的形式直接显示user_id是有值的,帮我看一下这段代码有什么问题:xtype:'combo',
fieldLabel:'操作人',
allowBlank:false,
blankText:'操作者姓名不能为空',
name:'userId',
//id:'user2',
store:new Ext.data.Store({
autoLoad:false,
reader:new Ext.data.JsonReader({
totalRecords:"totalCount",
root:"list",
id:"userId" },
Ext.data.Record.create([
{name:'deptId'},
{name:'userName'},
{name:'userEmail'}
])
),
proxy:new Ext.data.HttpProxy({
url:'getUserById.action?userId='+Ext.getCmp('userId').getValue()
}/* ,{ url:'showuser.action?deptId='+Ext.getCmp('dept2').getValue()
} */) }),
allQuery:'alltask',
triggerAction:'all',
editable:false,
loadingText:'正在加载员工列表',
displayField:'userName',
valueField:'userId',
emptyText:'请输入操作者姓名',
width:190,
mode:'remote'