What is the process for reloading the helper after modifying the values?

After the user selects an option, I am trying to filter information on my page. I created a "change" event and passed values through sessions. The console log shows that the values are being passed correctly. However, it seems like the helper is not refreshing because it doesn't return the find with the new values. In fact, it doesn't do anything. There is obviously something wrong. I apologize for my basic English skills; I hope you understand and can help me. Thank you for your time!

Template

<select id="mostrarTiposMenu" class="form-control">

        {{#each mostrarMenus}}
        <option value="{{nuevoTipoMenu}}" onchange="getMenu()">{{nuevoTipoMenu}}</option>
        {{/each}}
 </select>

Events and helpers

Template.main.events({
  "change #mostrarTiposMenu": function(evt) {
  var newValue = $(evt.target).val();
    Session.set("valueMenu", newValue);
    console.log("I am in the event " + newValue);
  }
});


Template.main.helpers({  
 mostrarMenus : function(){
    return Menu.find();
  },
  mostrarPrimerDia: function(){
    var searchMenu = Session.get("valueMenu")
    console.log("I am in the helper " + searchMenu)
 var server = TimeSync.serverTime()
 var diaDeHoy = moment(server).locale("es").add(0,'days').format('dddd');
 return Promociones.find({'metadata.diaOferta' : { $in: [diaDeHoy] } },{'metadata.tipoMenu' : { $in: [searchMenu] } });
  }
});

Answer №1

Have you attempted to utilize the refresh feature?

$('selectmenu).refresh();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to establish connections in MongoDB using a driver

In the system that I am currently working on, we utilize the connection table known as the inprog array in MongoDB to oversee and manage system availability and concurrency. This is made possible through the fantastic $cmd.sys.inprog collection. A helpful ...

What is the best way to implement rate limiting for Next.js server actions?

In my current project, I have implemented server actions in next.js following the guidelines provided on Server Actions Although everything is functioning properly, I am now looking to add rate limiting to the server action to prevent potential spam or at ...

Is there a Javascript tool available for creating a visual representation of the correlation between items in two separate

Does anyone have recommendations for an HTML/JavaScript/browser-based component that can map items in one list to another? Imagine a scenario where there is a list of items on the left-hand side and another list on the right, with the ability to click on a ...

Learning how to interpret input from the command line in Vertx

Would appreciate some guidance on how to read command line arguments in vert.x using JavaScript. For instance, I am wondering how to go about reading: arguments(arg1, arg2, arg3) vertx run example.js arg1 arg2 arg3 ...

Navigating Immutable JS Record through loop

As a newcomer to the ImmutableJS library, I've been grappling with a specific challenge. My goal is to iterate through an Immutable Record object named Options, extracting both the key and value for each item in the Record. The structure of my Options ...

How exactly did Google Fiber design their onboarding guide?

Are you using HTML5 canvas animation or Flash for this website? It's a bit difficult for me to discern. Thank you! ...

Unable to establish a connection with a replica set using the seed localhost:27017

I am currently working with mongoid version 1.4.12 and I have a local mongos instance set up. This mongos server is connected to several replica sets in sharding mode. In my mongoid.yml file, I have the following configuration: production: &productio ...

The Angular directive was unable to reach the controller located higher up in the DOM hierarchy

template <section id="content" ng-controller="ReservationController as resvnCtrl" > <form role="form" name="resvnCtrl.form"> <div data-date-picker> </div> ...

Combining arrays of objects in JavaScript

I am currently working on combining different arrays: const info1 = {id: 1} const info2 = {id: 2} const info3 = {id: 3} const array1 = [info1, info2] const array2 = [info1, info3] const array3 = [info2, info3] const union = [...new Set([...array1, ...arr ...

What could be causing jQuery's Promise.reject to fail?

Currently, I'm dealing with a REST API that resembles this stub: Snippet 1 (example based on Ruby on Rails). I have some existing jQuery code using classic callbacks: Snippet 2 It's running with these logs: case 1: [INFO] /api/my/action1: rece ...

"Is it possible to make a JSON API call in Node.js before exiting with a SIGINT

In my attempt to configure certain variables and make an API call using the request module before exiting the program, I encountered issues where the function was not being properly executed due to the presence of both SIGINT and exit signals: const reque ...

Regarding a listener within a quiz game's event system

I'm dealing with an issue in my quiz-game. I'm curious if I need to implement an event-listener for refreshing the initial page with a question and 4 options. Can anyone guide me on how to do this? My questions are stored using JSON. Here is the ...

What's the best way to mount a file on a field?

Can you assist in resolving this issue by utilizing a form on JSFiddle? If a user fills out the following fields: name, email, phone, message The data should be output to the console. However, if a user adds a file to the field attachment No output ...

My JavaScript code runs perfectly fine on JSFiddle, but for some reason, it's not functioning correctly on

I need a solution where a new button is generated every time the post button is clicked, and each of these buttons should have its own counter. This works successfully in JSFiddle, but unfortunately doesn't work when I try to implement it elsewhere. ...

Comparing Fetch and Axios: Which is Better?

Currently delving into the realms of axios and the fetch API, I am experimenting with sending requests using both methods. Here is an example of a POST request using the fetch API: let response = await fetch('https://online.yoco.com/v1/charges/&ap ...

Receive a positive or negative data message through Ajax Response

Exploring Ajax for the first time, I am eager to incorporate database interaction using AJAX in JQUERY by connecting to a PHP script. $(function() { $.ajax({ type: "POST", url: "response.php", ...

Click on a table cell in Vue to display its corresponding data in a modal

I have successfully implemented a modal in my Vue component that works well with static text inside it, confirming its functionality. However, when attempting to pass data from the table cell that is being clicked into the modal, I encountered an error st ...

Javascript code fails to execute properly on IE8

I have a scenario where I am working with two drop-down menus. When the user selects an option from one menu, it should dynamically change the options in the other menu. However, I'm facing an issue with Internet Explorer where the second drop-down me ...

Tips for updating a value within ng-repeat only if the value is equal to "string"; otherwise, hide it from display

I'm having trouble updating the data in my table to display "Yup" or blank space based on certain conditions. I am new to this and tried a solution, but it's not working: {{ person.value ? "Yup":" "}} .. Can anyone help me with this? angular.m ...

offsetWidth varies across different browsers

There seems to be a 1px difference in the value of element.offsetWidth between Firefox and Chrome. I have been researching this issue. I attempted to apply a CSS reset and moved the element further away from the screen borders (as older versions of IE wer ...