我创建了一个 fiddle ,它演示了错误。问题是标记字段忽略了 minChars
属性 - 当您第一次关注该字段时,您可以看到对服务器的请求,这不应该发生。我对组合框做了同样的事情,一切正常。这是我的代码:
Ext.create("Ext.form.field.Tag", {
renderTo: "test",
minChars: 999, //ignored, even though is documented
enableKeyEvents: true,
displayField: "text",
valueField: "id",
queryMode: "remote",
autocomplete: "off",
fieldLabel: "tagfield",
store: {
autoLoad:false,
fields:[{name:'id'},{name:'text'}],
proxy:{
type:'ajax',
url:'getData.php'
}
}
});
Ext.create("Ext.form.field.ComboBox", {
renderTo: "test2",
minChars: 999,
enableKeyEvents: true,
displayField: "text",
valueField: "id",
queryMode: "remote",
autocomplete: "off",
fieldLabel: "combo",
store: {
autoLoad:false,
fields:[{name:'id'},{name:'text'}],
proxy:{
type:'ajax',
url:'getData.php'
}
}
});
请注意,combobox 和 tagfield 中的 minChars
有类似的记录([1],[2]):
minChars : Number
The minimum number of characters the user must type before autocomplete and typeAhead activate.
那么,我该如何修复这个错误呢?
最佳答案
您需要根据组合框过滤结果的方式设置 triggerAction:'all' 或 triggerAction:'query' 配置选项。
关于javascript - ExtJS 6 标记字段中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40799498/