I am using list.js to search/sort an unordered list which works well. However, I would like to add searching for a few columns that contain numeric values. When searched, it would return all the items equal to or greater than the searched value.
Example
Values: 24,65,95,104
Search: 80
Returns: 95,104
How can I achieve this? Thanks in advance. I also found this code which might be helpful:
$('.filter-2').on('click', function() {
userList.filter(function(item) {
var born = parseInt(item.values().born);
console.log(born);
if (born < 1986) {
return true;
} else {
return false;
}
});
});
In plain javascript:
var array = [24,65,95,104];
console.log(arr.filter(function (num){
return number > 80;
}));
In list.js it's very similar with filter method:
itemsInList = [ { id: 1, name: "Jonny" } , { id: 2, name: "Gustaf" } , { id: 3, name: "Jonas" } ]; listObj.filter(function(item) { return item.values().id > 1; }); // Only items with id > 1 are shown in list