mirror of
https://gitlab.com/bmcgonag/get_my.git
synced 2026-03-27 00:08:49 +00:00
Cleaning up type ahead
This commit is contained in:
parent
cba5026ee4
commit
dbd945391d
4 changed files with 11 additions and 14 deletions
|
|
@ -20,7 +20,7 @@
|
|||
<i class="material-icons clickable" id="filterOff">clear</i>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="col s10 m11 l11">
|
||||
<div class="col s4 m3 l3">
|
||||
Filter LIst
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -35,11 +35,11 @@
|
|||
</div>
|
||||
{{else}}
|
||||
<div class="row">
|
||||
<div class="col s9 m10 l10 input-field">
|
||||
<input type="text" class="autocomplete" id="findListItems" />
|
||||
<div class="col s8 m9 l10 input-field">
|
||||
<input type="text" class="autocomplete" id="findListItems" autocomplete="off" />
|
||||
<label for="findListItems">Item...</label>
|
||||
</div>
|
||||
<div class="col s3 m2 l2">
|
||||
<div class="col s4 m3 l2">
|
||||
<a class="waves-effect waves-light btn saveListItem green right">Add</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ Template.listsTbl.events({
|
|||
if (listId == "addList") {
|
||||
$('#modalList').modal('open');
|
||||
} else {
|
||||
console.log("listId is: " + listId);
|
||||
// console.log("listId is: " + listId);
|
||||
Session.set("listId", listId);
|
||||
Meteor.setTimeout(function() {
|
||||
FlowRouter.go('/listitems');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue