I have a ComboBox with a remote store with local filtering.
Instead of the default filtering, by the first characters like %query, I want to filter with the contains/anyMatch mode like %query%.
I tried to solve this with the answers in the question: ExtJs: Search / Filter within a ComboBox, but it didn't worked.
Code:
var users = Ext.create('Ext.form.ComboBox',{
displayField : 'userName',
valueField : 'userName',
queryMode : 'local',
typeAhead : true,
store : Ext.create('Ext.data.Store', {
model : 'User',
proxy : {
type : 'ajax',
url : './user/list',
reader : {
type: 'json',
root: 'data'
}
}
});
});
Thanks!
Use anyMatch config option since Ext 4.2.1. In earlier versions it looks like you'll need to override doQuery method in Ext.form.field.ComboBox just to be able to add that option to the filter instance you'll find in there:
me.activeFilter = new Ext.util.Filter({
root: 'data',
anyMatch: true, // <- add this
property: me.displayField,
value: queryString
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With