I have a working, searchable list with HTML and list.js. I also have 3 filters that pare the list down to a smaller list based on some information within each list item. How can I clear my filters when I start typing in the search box? Not fuzzy, just basic instant search.
var options = {
valueNames: ['name', 'description', 'category']
};
var featureList = new List('qme-list', options);
/* 1 = Qualifying expense 2 = Potentially qualifying epxense 3= Not a qualifying expense*/
$('#filter-1').click(function () {
featureList.filter(function (item) {
if (item.values().category == "1") {
return true;
} else {
return false;
}
});
return false;
});
$('#filter-2').click(function () {
featureList.filter(function (item) {
if (item.values().category == "2") {
return true;
} else {
return false;
}
});
return false;
});
$('#filter-3').click(function () {
featureList.filter(function (item) {
if (item.values().category == "3") {
return true;
} else {
return false;
}
});
return false;
});
$('#filter-none').click(function () {
featureList.filter();
return false;
});
Aucun commentaire:
Enregistrer un commentaire