Posted 2 July 2021, 2:34 am EST
below are the code
private getFilterMethod(binding, prop) {
return items => {
if (this[prop] != ‘’) {
if (this[prop].toLowerCase().startsWith(‘‘)) {
let searchedText = this[prop].toLowerCase().substring(1);
let arr = Object.values(items);
return arr
.map(v =>
v
.toString()
.toLowerCase()
.endsWith(searchedText)
)
.indexOf(true) > -1
? true
: false;
} else if (this[prop].toLowerCase().endsWith(’’)) {
let searchedText = this[prop]
.toLowerCase()
.substring(0, this[prop].length - 1);
let arr = Object.values(items);
return arr
.map(v =>
v
.toString()
.toLowerCase()
.startsWith(searchedText)
)
.indexOf(true) > -1
? true
: false;
} else {
let searchedText = this[prop]
.toLowerCase()
.substring(0, this[prop].length - 1);
let arr = Object.values(items);
return arr
.map(v =>
v
.toString()
.toLowerCase()
.startsWith(searchedText)
)
.indexOf(true) > -1
? true
: false;
}
} else {
return items;
}
};
}
this.data1.filters.push(
this.getFilterMethod.call(this, ‘Name’, ‘EntityName’),
this.getFilterMethod.call(this, ‘Number’, ‘EntityNumber’),
this.getFilterMethod.call(this, ‘TenantName’, ‘ClientName’),
this.getFilterMethod.call(this, ‘TenantNumber’, ‘ClientNumber’)
);
search with * working as expected, but search without * not filtering data it is empty