gpt4 book ai didi

javascript - ExtJS--带有 queryMode "local"的组合框的 typeAhead --无法查询子字符串

转载 作者:行者123 更新时间:2023-12-02 15:59:56 25 4
gpt4 key购买 nike

我使用的是 Ext 4.1.1

我有一个为 queryMode:"local"启用 typeAhead 的组合框。只要您只查询 displayField 的前缀,它就可以正常工作。但是,当您在该显示字段中查询子字符串时,什么也不会发生。

{
xtype:"combo",
fieldLabel:"Country",
name:"COUNTRY",
itemId:"countryFilterFld",
labelPad:5,
typeAhead:true
queryMode:"local",
valueField:"ID",
displayField:"LABEL",
store:store
}

例如,标签之一是“美国”。如果我开始输入“United”,“United States”就会被过滤。但如果我输入“States”,则什么也不会发生。

我还尝试监听组合框“更改”事件,然后获取值并过滤组合框存储,但更改事件甚至没有被触发。

listeners: {           
change: function(cbo_) {
var store = cbo_.getStore();
store.clearFilter();
store.filter({
property: 'LABEL',
anyMatch: true,
value : cbo_.getValue()
})
}
},

我在更改事件处理程序中设置了一个断点,但该事件从未触发,即使我不再关注该字段也是如此。

最佳答案

使用anyMatch在你的组合上:

Configure as true to allow matching of the typed characters at any position in the valueField's value.

例如:

{
xtype: "combo",
fieldLabel: "Country",
name: "COUNTRY",
itemId: "countryFilterFld",
labelPad: 5,
typeAhead: true
queryMode: "local",
valueField: "ID",
displayField: "LABEL",
store: store,
anyMatch: true
}

关于javascript - ExtJS--带有 queryMode "local"的组合框的 typeAhead --无法查询子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31275136/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com