I would like to know if you can help me with the following problems that occurred to me when creating filters within the plugin that I am creating.
Problem 1:
The filter with the listener change
I have assigned to clean the data, once the user chooses an item in the list. Everything is great, until, when I do a search for one of them: name / description / id and I click on the result that was found (item), clean it correctly and go back to show all. Now, when I find an item when I search, and press enter , I select the item, but I do not clean it with the filter and therefore, the list with all the items does not appear , but only the one that I selected.
Code (Plugin and Filters)
Ext.define("M5.view.custom.FilterCustom", {
extend: "Ext.AbstractPlugin",
xtype: 'filtercustom',
name: 'customFilter',
fieldName: 'name',
fieldName: 'desc',
fieldName: 'id',
constructor: function() {
var me = this;
me.callParent(arguments);
},
init: function(combo) {
var me = this;
combo.on("keyup", function() {
var store = combo.getStore();
var value = combo.rawValue;
store.clearFilter();
var cfilter = [
new Ext.util.Filter({
filterFn: function(item) {
return item.data.name.indexOf(value) !== -1 || item.data.id.indexOf(value) !== -1 || item.data.desc.indexOf(value) !== -1;
}
})];
var test = me;
console.log(test);
//console.log('Yaay, the filter works fine!');
store.filter(cfilter);
}, this),
combo.on("change", function() {
var store = combo.getStore();
store.clearFilter();
}, this);
}
});
Problem 2:
When I do the search, you need to write exactly the value of each item to show / find it. And I need that even if I write lower case or uppercase I find it. Now, the problem with this is the (2.1) caseSensitive
and the (2.2) anyMatch
, which I do not understand where I should add them to work.
2.1:
caseSensitive: false
2.2:
anyMatch: true
Problem 3:
Los:
fieldName: 'blabla'
I should be able to use them when I validate in the listener keyup
with the return
, but, again, I have no idea how to correctly add that within the validation, since, stressing, I am something new with ExtJS . If someone can help, thank you very much.