javascript 用于选择选定值的 ExtJS 4 Combobox 事件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15299182/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ExtJS 4 Combobox event for selecting selected value
提问by Dawid Mazur
For some reason I need to know when user has selected value from combobox even if it is already selected. "Select" event works only if user selects unselected item. I don't see any event like "itemclick" in the docs for combobox or picker. Any ideas?
出于某种原因,我需要知道用户何时从组合框中选择了值,即使它已经被选中。“选择”事件仅在用户选择未选择的项目时才起作用。我在组合框或选择器的文档中没有看到任何类似“itemclick”的事件。有任何想法吗?
回答by Molecular Man
ComboBox
uses BoundListfor representing dropdown list. BoundList
fires itemclickevent. You can use ComboBox
's listConfigconfig in order to setup BoundList
listeners:
ComboBox
使用BoundList表示下拉列表。BoundList
触发itemclick事件。您可以使用ComboBox
的listConfig配置来设置BoundList
侦听器:
Ext.create('Ext.form.ComboBox', {
// ...
listConfig: {
listeners: {
itemclick: function(list, record) {
alert(record.get('name') + ' clicked');
}
}
}
}
Check out the demo.
查看演示。