9
私はメーターでLeaderboardの例を試していますが、私はクリックイベントの設定に何か間違っています。この例では、3つのボタンがあり、1つは列ごとにソートを変更し、もう1つは全員に5つのボーナスポイントを追加します。流星のシンプルなイベントを設定する
は、ここにHTMLです:
<div id="outer">
{{> sorter}}
{{> leaderboard}}
</div>
<template name="sorter">
<span>Sorted by {{sortedBy}}</span>
{{#if sortByName}}
<input type="button" id="sortScore" value="sort by score" />
{{else}}
<input type="button" id="sortName" value="sort by name" />
{{/if}}
<input type="button" class="incAll" value="5 bonus points to all" />
</template>
そして、ここでは、JSです:Session.set( 'ORDERBY'、 '名前')を呼び出す
Template.sorter.events = {
'click #sortName': function(){
Session.set('orderby', 'name');
},
'click #sortScore': function(){
Session.set('orderby', 'score');
},
'click input.incAll': function(){
Players.find().forEach(function(player){
Players.update(player._id, {$inc: {score: 5}});
});
}
}
。コンソール上で動作し、それに応じてHTMLを更新しますが、ボタンをクリックしても表示されません。それで私は何が欠けているのですか?
ありがとうございます。
これはまだ修正されていますか? –
はい、修正されました(この質問を見ている他の人たちのために) – PRB