arrayIndexOf() || indexOf()
Using arrayIndexOf()
or indexOf(), find all matched items from an array collection. If items matched
then returns true else returns false.
var arrayIndexOf = function (keyword) {
try {
var keyText = keyword.toLowerCase();
if (!keyText) {
return arrayCollection();
}
else {
if (arrayCollection().length > 0) {
var match = ko.utils.arrayIndexOf(arrayCollection(), function (item){
return item.Lable.toLowerCase()
=== keyword.toLowerCase();
});
If(match){
return true;
}
else{
return false;
}
}
}
}
catch (ex) {
//TODO: something..
}
};