【发布时间】:2013-12-24 18:40:53
【问题描述】:
我有一个meteorjs 模板,我用它来呈现一些记录。我想要做的是,当数据库发生任何变化时,我想手动调用模板渲染方法。我可以仅从 DOM 重新加载一个模板以反映更改吗?我的代码是
<template name="textlines">
<table class="table table-striped table-bordered table-condensed table-hover listing"
id="content_listing-table">
<thead>
<tr>
<th>Text Lines</th>
</tr>
</thead>
<tbody>
{{#each textline}}
<tr>
<td>
<a href="#" data-id={{_id}} class="edit"> {{texts}}</a>
</td>
</tr>
{{/each}}
</tbody>
</table>
</template>
我的流星渲染方法是这样的
Template.textlines.rendered = function () {
$("#content_listing-table").dataTable();
}
现在我想在对数据库进行 CRUD 操作后手动调用此 Template.textlines.rendered 方法。我不知道我问的是对还是错,有没有可能。我在使用数据表时遇到了一些问题。所以我想每次手动刷新模板,将数据库返回的内容添加到dataTable中。谢谢
【问题讨论】:
-
textlines是如何定义的? -
textlines 是模板名称。和 textline 来自数据库
-
哦,我是说
textline
标签: jquery meteor datatables jquery-datatables meteorite