我有一个有远程商店的组合框。当用户写下三个或更多字母时,我看到一个服务器请求,但我想在用户点击Enter按钮时触发此请求。此时我的组合具有以下属性:
forceSelection:true,
enableKeyEvents:true,
listeners:{
keyup:function(){ // I prevent "normal" server requests in this manner
return false;
},
keydown:function(){
return false;
},
keypress: function() {
return false;
},
specialkey:function(a,b,c){
if(b.keyCode==13){
// But at this moment I want to make a request
}
}
}
答案 0 :(得分:1)
您可以设置' minChars'为了一个非常高的值,在打字时禁用值选择。 http://docs.sencha.com/extjs/4.2.3/#!/api/Ext.form.field.ComboBox-cfg-minChars
然后在输入键上展开组合框选择:
forceSelection:true,
enableKeyEvents:true,
// show value selection after typing 999 chars
minChars: 999,
// set triggerAction to 'query' to show only filtered results after pressing enter
triggerAction: 'query',
listeners: {
specialkey: function (a, b, c) {
if (b.keyCode == 13){
// a is combobox
a.expand();
}
}
}