I am trying to filter data based on input and it works fine but I want add an extra condition to it. It should return if titel or another value (for example sendFrom) is given.
const newData = masterDataSource.filter(function (item) {
const itemData = item.titel ? item.titel.toUpperCase() : ''.toUpperCase();
const textData = text.toUpperCase();
return itemData.indexOf(textData) > -1;
});
I tried adding some operators but it didn´t worked out as planed
const newData = masterDataSource.filter(function (item) {
const itemData = item.titel || item.sendFrom ? item.titel.toUpperCase() || item.sendFrom.toUpperCase() : ''.toUpperCase();
const textData = text.toUpperCase();
return itemData.indexOf(textData) > -1;
});
thanks
""?