mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Added filtering option to Lists and Products views.
This commit is contained in:
parent
0768e707b8
commit
7641b17e6f
6 changed files with 208 additions and 20 deletions
|
|
@ -8,16 +8,25 @@ Template.listItemsTbl.onCreated(function() {
|
|||
|
||||
Template.listItemsTbl.onRendered(function() {
|
||||
Session.set("showReceivedItems", false);
|
||||
Session.set("searchVal", "");
|
||||
});
|
||||
|
||||
Template.listItemsTbl.helpers({
|
||||
'thisListItems': function() {
|
||||
let showRecvd = Session.get("showReceivedItems");
|
||||
console.log("Show Received is: " + showRecvd);
|
||||
let searchVal = Session.get("searchVal");;
|
||||
if (showRecvd == false) {
|
||||
return ListItems.find({ itemReceived: false });
|
||||
if (typeof searchVal == 'undefined' || searchVal.length === 0) {
|
||||
return ListItems.find({ itemReceived: false });
|
||||
} else {
|
||||
return ListItems.find({ itemReceived: false, itemName: { $regex: searchVal + '.*', $options: 'i' } });
|
||||
}
|
||||
} else {
|
||||
return ListItems.find({});
|
||||
if (typeof searchVal == 'undefined' || searchVal.length == 0) {
|
||||
return ListItems.find({});
|
||||
} else {
|
||||
return ListItems.find({ itemName: { $regex: searchVal + '.*', $options: 'i' } });
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
@ -63,5 +72,5 @@ Template.listItemsTbl.events({
|
|||
console.log(" SUCCESS deleting the list item.");
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue