I have a view with a table that I want to be able to filter what is displayed based on a filtered string entered by the user. The one problem that I am running into is that the fields could be null so my filter does not work.
var quoteNameFilter = function () {
return function (quotes, filterValue) {
if (!filterValue) return quotes;
var matches = [];
filterValue = filterValue.toLowerCase();
for (var i = 0; i < quotes.length; i++) {
var quote = quotes[i];
if (quote.rfq.toLowerCase().indexOf(filterValue) > -1 ||
quote.comments.toLowerCase().indexOf(filterValue) > -1 ||
quote.priority.name.toLowerCase().indexOf(filterValue) > -1 ||
quote.customer.customerName.toLowerCase().indexOf(filterValue) > -1 ||
quote.status.name.toLowerCase().indexOf(filterValue) > -1) {
matches.push(quote);
}
}
return matches;
};
};
quote.comments could be null, so how do I check if the value is null in this routine?