ext combobox 如何触发select事件

shrimpma 2011-12-15 11:59:56
new Ext.form.ComboBox({
id: 'usertype',
hiddenName: "atype",
hiddenValue:"F",
fieldLabel: '用户类型',
typeAhead: true,
triggerAction: 'all',
lazyRender: false,
value: '普通用户',
width: 195,
mode: 'local',
store: new Ext.data.ArrayStore({
id: 3,
fields: ['value', 'displayText'],
data: [
['F', '普通用户'],
['D', '认证用户'],
['R', 'Radius认证用户']
]
}),
valueField: 'value',
displayField: 'displayText',
listeners: {
select: function (a, b, c) {
var d = b.data.value;
if (d == 'F') {

//do something
} else if (d == 'D') {

//do somethins 2
} else {

//dom somethins 3

}
}
}
})

我用Ext.getCmp("usertype").setValue("认证用户"); 后,希望combobox会自动去 //do somethins 2,但是setValue后,不行?怎么触发select 事件?
...全文
860 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
豆虫 2011-12-15
  • 打赏
  • 举报
回复
fireEvent方法手动触发:

fireEvent( String eventName, Object... args ) : Boolean
Fires the specified event with the passed parameters (minus the event name).
Parameters:
eventName : String
args : Object...
Variable number of parameters are passed to handlers
Returns:
Boolean
returns false if any of the handlers return false otherwise it returns true

87,902

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧