mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 08:18:50 +00:00
Cleaning up type ahead
This commit is contained in:
parent
cba5026ee4
commit
dbd945391d
4 changed files with 11 additions and 14 deletions
|
|
@ -19,6 +19,7 @@ Template.listItemsForm.onRendered(function() {
|
|||
Session.set("itemReqErr", false);
|
||||
Session.set("showReceivedItems", false);
|
||||
Session.set("filtering", false);
|
||||
Session.set("findListItems", {});
|
||||
this.autorun(() => {
|
||||
$('input.autocomplete').autocomplete({
|
||||
data: Session.get("findListItems"),
|
||||
|
|
@ -96,16 +97,20 @@ Template.listItemsForm.events({
|
|||
if (event.which !== 13) {
|
||||
let listItemObj = {};
|
||||
let findItemVal = $("#findListItems").val();
|
||||
console.log("Should start showing options now...");
|
||||
Session.set("listItemVal", findItemVal);
|
||||
let listItemInfo = Products.find({ prodName: {$regex: findItemVal + '.*', $options: 'i'}}, { limit: 5 }).fetch();
|
||||
if (typeof listItemInfo != 'undefined' && listItemInfo != "" && listItemInfo != null) {
|
||||
// console.log(" listItemInfo: ");
|
||||
// console.dir(listItemInfo);
|
||||
for (i=0; i < listItemInfo.length; i++) {
|
||||
let item = listItemInfo[i].prodName;
|
||||
let store = listItemInfo[i].prodStore;
|
||||
listItemObj[item] = store;
|
||||
}
|
||||
Session.set("findListItems", listItemObj);
|
||||
}
|
||||
Session.set("findListItems", listItemObj);
|
||||
|
||||
}
|
||||
},
|
||||
'click #filterOn' (event) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue