Made items list in alphabetical order

This commit is contained in:
Brian McGonagill 2024-08-18 09:59:58 -05:00
parent 9fdb7e4b7d
commit c41857ab3e

View file

@ -22,19 +22,19 @@ Template.prodMgmtTbl.helpers({
if (typeof searchVal == 'undefined' || searchVal.length == 0) {
return Products.find({});
} else {
return Products.find({ prodName: { $regex: searchVal + '.*', $options: 'i' } });
return Products.find({ prodName: { $regex: searchVal + '.*', $options: 'i' } }, { sort: { prodName: 1 }});
}
} else if (searchStore == true) {
let searchVal = Session.get("searchStoreVal");
if (typeof searchVal == 'undefined' || searchVal.length == 0) {
return Products.find({});
} else {
return Products.find({ prodStore: { $regex: searchVal + '.*', $options: 'i' } });
return Products.find({ prodStore: { $regex: searchVal + '.*', $options: 'i' } }, { sort: { prodName: 1 }});
}
} else if (noStoreSet == true) {
return Products.find({ prodStore: '' });
return Products.find({ prodStore: '' }, { sort: { prodName: 1 }});
} else {
return Products.find({});
return Products.find({}, { sort: { prodName: 1 }});
}
},
searchProd: function() {