禁用组合框的箭头键导航
Disable ArrowKey Navigation For ComboBox
我向组合框添加了一个侦听器以禁用箭头键导航(实质上是强制用户使用鼠标)。但是,在搜索互联网后,我没有发现任何有希望的东西。这里有人可以帮我解决问题吗?或者把我推向正确的方向?
listeners:{
specialkey: function (combo,e){
if ((e.getKey() == combo.UP)||(e.getKey() == combo.DOWN)) {
e.stopEvent();
}
}
},
这是禁用键盘导航的 giga, tera.. 脏解决方案。我不确定它是否不会得到一些新的错误。
首先,我删除了 initEvents 方法,这对于禁用 KeyDown 组合扩展功能非常不利。之后,我从 boundList 中删除了导航实用程序 class:'Ext.view.BoundListKeyNav'.
Ext.application({
name: 'Fiddle',
launch: function () {
// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [{
"abbr": "AL",
"name": "Alabama"
}, {
"abbr": "AK",
"name": "Alaska"
}, {
"abbr": "AZ",
"name": "Arizona"
}]
});
// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody(),
initEvents: Ext.emptyFn, // This will disable KeyDown combo expand
listConfig: {
navigationModel: null // This will disable KeyNavigation in the list
}
});
}
});
我向组合框添加了一个侦听器以禁用箭头键导航(实质上是强制用户使用鼠标)。但是,在搜索互联网后,我没有发现任何有希望的东西。这里有人可以帮我解决问题吗?或者把我推向正确的方向?
listeners:{
specialkey: function (combo,e){
if ((e.getKey() == combo.UP)||(e.getKey() == combo.DOWN)) {
e.stopEvent();
}
}
},
这是禁用键盘导航的 giga, tera.. 脏解决方案。我不确定它是否不会得到一些新的错误。 首先,我删除了 initEvents 方法,这对于禁用 KeyDown 组合扩展功能非常不利。之后,我从 boundList 中删除了导航实用程序 class:'Ext.view.BoundListKeyNav'.
Ext.application({
name: 'Fiddle',
launch: function () {
// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [{
"abbr": "AL",
"name": "Alabama"
}, {
"abbr": "AK",
"name": "Alaska"
}, {
"abbr": "AZ",
"name": "Arizona"
}]
});
// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
fieldLabel: 'Choose State',
store: states,
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
renderTo: Ext.getBody(),
initEvents: Ext.emptyFn, // This will disable KeyDown combo expand
listConfig: {
navigationModel: null // This will disable KeyNavigation in the list
}
});
}
});