I'm trying to search for the fname, mname and lname together. Right now, i can only search by fname, mname and lname but not together.
Example: I'm trying to search for "Jacob jj9eqwif Nguyen" but it doesnt work. But try to search for Jacob and it works. Try to search for jj9eqif and it works. Try to search for Nguyen and it works.
Pls see this link
search(event) {
const val = event.target.value.toLowerCase();
if (!val) {
this.data = this.tempData;
}
const temp = this.tempData.filter(row => {
return Object.keys(row).some(property => {
if (property === 'received_by') {
return row[property].fname
.toString()
.toLowerCase()
.indexOf(val) !== -1
? row[property].fname
.toString()
.toLowerCase()
.indexOf(val) !== -1
: row[property].mname
.toString()
.toLowerCase()
.indexOf(val) !== -1
? row[property].mname
.toString()
.toLowerCase()
.indexOf(val) !== -1
: row[property].lname
.toString()
.toLowerCase()
.indexOf(val) !== -1
? row[property].lname
.toString()
.toLowerCase()
.indexOf(val) !== -1
: (row[property].fname + row[property].lname + row[property].mname)
.toString()
.toLowerCase()
.indexOf(val) !== -1;
}
if (property === 'warehouse') {
return (
row[property].name
.toString()
.toLowerCase()
.indexOf(val) !== -1
);
} else {
return row[property] === null
? null
: row[property]
.toString()
.toLowerCase()
.indexOf(val) !== -1;
}
});
});
this.data = temp;
}
search for the fname, mname and lname togetherwith some example search text?