我需要帮助,因为我开发了 meteorjs app ,因为我想编辑客户端行{{cid}}值,但它无效。这是我的代码请验证我在哪里弄错了建议我。
clientJs:
//Edit client info
Template.client.events({
'click .clientrow':function(e,t){
console.log("You Edit Client Row");
e.preventDefault();
alert(tmpl.data._id);
}
});
my template:
<table class="table table-bordered tablestriped table-hover">
<thead>
<tr>
<th>Client Id</th>
<th>Medical RNO</th>
<th>Client</th>
<th>Referral Date</th>
<th>Referred By</th>
<th>Clinician</th>
<th>Service</th>
<th>Episode</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{{#each clientList}}
<tr class="clientrow">
<td>{{cid}}</td>
<td>{{mrno}}</td>
<td>{{client}}</td>
<td>{{formatDate rdate}}</td>
<td>{{referredby}}</td>
<td>{{clinecian}}</td>
<td>{{serviece}}</td>
<td>{{episode}}</td>
<td>{{actions}}</td>
</tr>
{{/each}}
</tbody>
</table>
答案 0 :(得分:0)
我很累,所以这可能需要一些调整,但
var cid = $(t).find('td:first')。text();
或
var cid = $('td:first',$(t).parents('tr'))。text();
或
var cid = $('td:first',$(t))。text();
或
答案 1 :(得分:0)
Template.client.events({ 'click .clientrow':function(e,t){
e.preventDefault();
console.log("You Select Client Row " + this.client);
alert(this.mrno + ' ' + this.client);
}
});