javascript - Meteor template doesn't re-render even though its helper is called? -
ive got template on front end:
if tournament .tournament if round each round ul(class='round#{currentround} of#{rounds}') each match li each participant if winner .participant.winner a(href='#') span.participant-title #{displayname} span.participant-number #{rank} span.participant-id #{id} span.participant-status #{status} span.participant-round #{thisround} span.participant-match #{thismatch} else if pending .participant a(href='#') span.participant-title waiting... span.participant-number xxx span.participant-id #{id} span.participant-status #{status} span.participant-pending span.participant-disagree #{disagree} span.participant-round #{thisround} span.participant-match #{thismatch} else .participant.loser a(href='#') span.participant-title #{displayname} span.participant-number #{rank} span.participant-id #{id} span.participant-status #{status} span.participant-round #{thisround} span.participant-match #{thismatch} else h1#not-found tournament not found
and helper:
tournament: function(){ if (this.tournament) { return true; }else{ return false; } }, round: function() { var tournament = this.tournament.brackets; var rounds = tournament.length; var results = []; tournament.map(function(value, index){ var currentround = index + 1; results.push({rounds: rounds, currentround: currentround, matches: value}); }); return results; }, match: function(){ return this.matches; }, participant: function(){ var results = []; this.map(function (value, index) { var type = value['win']; var obj = { id: value['id'], rank: value['id'].slice(0,3), displayname: value['displayname'], thisround: value['round'], thismatch: value['match'], status: type, disagree: value['disagree'] }; if (value['disagree']) { console.log("value:", value); } if (type === true || type === 'undetermined') { obj.winner = true; }else if (type === 'pending'){ obj.pending = true; }else{ obj.loser = true; } results.push(obj); }); return results; }
the helper getting ran everytime tournament object changes... template gets updated first time meteor method called?
have ever encoutered before? can post meteor method if too.
where change data:
meteor.call('submitwinner', winnerinfo, thiscampaign._id, meteor.user().apikey, function(error, result) { // display error user , abort if (error){ return alert(error.reason); }else{ // update css? var updatewaiting = $('.last-submitted').closest('.participant'); // updatewaiting.html('<a href=#><span class=participant-title>waiting...</span> <span class=participant-number>xxx</span></a>'); // updatewaiting.removeclass('undetermined') $('#theatermode').hide(); $('.swearbox').hide(); } });
Comments
Post a Comment