在响应式(Reactive)表中,数据上下文传递到整行,我必须在单击其中一列时触发一个事件,然后使用传递到该行的数据。
"click td": function(event, tmpl) {
//here "this" doesn't give the data,even "tmpl" doesn't have it.
}
最佳答案
在 Meteor 的事件处理程序中,第二个参数将是定义事件的模板的实例。从模板实例中,您可以获得数据上下文。根据您的情况:
Templates.myTableRow.events({
'click td': function(event, template) {
console.log("Row data context is:", template.data);
}
});
关于javascript - 在响应式(Reactive)表中单击其中一列时如何获取表行的数据上下文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36042659/