ExtJS--typeAhead for combobox with queryMode "local"--无法查询子字符串
ExtJS--typeAhead for combobox with queryMode "local"--cant query for substring
我正在使用 Ext 4.1.1
我有一个为 queryMode 启用了 typeAhead 的组合框:"local"。只要您只查询 displayField 的前缀,它就可以正常工作。但是当您在该显示字段中查询子字符串时没有任何反应。
{
xtype:"combo",
fieldLabel:"Country",
name:"COUNTRY",
itemId:"countryFilterFld",
labelPad:5,
typeAhead:true
queryMode:"local",
valueField:"ID",
displayField:"LABEL",
store:store
}
例如,其中一个标签是 "United States"。如果我开始输入 "United","United States" 会被过滤掉。但是如果我输入 "States",什么也不会发生。
我也试过监听组合框 "change" 事件,然后获取值并过滤组合框存储,但更改事件甚至没有被触发。
listeners: {
change: function(cbo_) {
var store = cbo_.getStore();
store.clearFilter();
store.filter({
property: 'LABEL',
anyMatch: true,
value : cbo_.getValue()
})
}
},
我在 change 事件处理程序中设置了一个断点,但该事件从未被触发,即使在我不再关注该字段之后也是如此。
在你的组合上使用 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
}
我正在使用 Ext 4.1.1
我有一个为 queryMode 启用了 typeAhead 的组合框:"local"。只要您只查询 displayField 的前缀,它就可以正常工作。但是当您在该显示字段中查询子字符串时没有任何反应。
{
xtype:"combo",
fieldLabel:"Country",
name:"COUNTRY",
itemId:"countryFilterFld",
labelPad:5,
typeAhead:true
queryMode:"local",
valueField:"ID",
displayField:"LABEL",
store:store
}
例如,其中一个标签是 "United States"。如果我开始输入 "United","United States" 会被过滤掉。但是如果我输入 "States",什么也不会发生。
我也试过监听组合框 "change" 事件,然后获取值并过滤组合框存储,但更改事件甚至没有被触发。
listeners: {
change: function(cbo_) {
var store = cbo_.getStore();
store.clearFilter();
store.filter({
property: 'LABEL',
anyMatch: true,
value : cbo_.getValue()
})
}
},
我在 change 事件处理程序中设置了一个断点,但该事件从未被触发,即使在我不再关注该字段之后也是如此。
在你的组合上使用 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
}