I have a page running with Meteor.js only running on the client. I'm using iron-router for setting up the page URL. I have this in the before section to set a session variable:
before: function () {
Session.set('employee-number', 0);
}
The html has a section with a text box
<div class="row-fluid employee-gift-main">
<div class="span4">
<label>
<span># Employees</span>
<input type="text" size="4" data-stripe="employee-text" class="employee-gift input-block-level" id="employee" placeholder="xx"/>
</label>
</div>
</div>
And the js file has a keypress event:
'keyup .employee-gift': function(event, template) {
if ((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode != 27 && event.keyCode != 13 && event.keyCode != 10 && event.keyCode != 8)) {
$("#employee").val($("#employee").val().substring(0,$("#employee").val().length - 1));
}
else if (event.keyCode >= 48 || event.keyCode <= 57) {
Session.set('employee-number',$("#employee").val());
}
}
Now, when I set the session variable, it changes some values on some pricing like calculating fees and taxes:
sponsorFeeTotal: function() {
var adminFee = 0;
if(Session.get('firstTime'))
adminFee = 45*0.13;
if( Session.get('employee-number') == '')
return (Session.get('sponsorFee')+adminFee+parseFloat(Session.get('getTax'))).toFixed(2);
else
return (Session.get('sponsorFee')+parseInt(Session.get('employee-number'))*20*0.13+parseInt(Session.get('employee-number'))*20+adminFee+parseFloat(Session.get('getTax'))).toFixed(2);
},
geTax :function() {
var adminFee = 0;
if(Session.get('firstTime'))
adminFee = 45*0.13;
if( Session.get('employee-number') == '')
return (Session.get('getTax')+adminFee).toFixed(2);
else
return (Session.get('getTax')+adminFee+parseInt(Session.get('employee-number'))*20*0.13).toFixed(2);
},
employeeNumber: function() {
return parseInt(Session.get('employee-number'));
},
employeeNumberValue: function() {
return parseInt(Session.get('employee-number'))*20;
}
The get methods then force all the text inputs including the #employee field to be re-loaded. I understand that meteor UI automatically re-renders the parts that depend on a specific key (employee-number) if that key changes. However, this code was working fine with a previous version of meteor. Has the behaviour changed recently and how do I fix this issue ?