I'm having a problem with my Meteor app. Apparently, the datatable does not update properly. When I save a new data, it automatically adds a new row, but the table is not updating correctly (e.g. it says 'Showing 1 to 6 of 6 entries' when in fact it has 7 entries already.)
I also tried destroying the table then re-initializing it again, but no luck. I've read the autorun function, but I'm not sure how to implement it.
Is there a way to manually refresh/re-render the template via JS? So that I can just refresh it once I successfully add the data into the collection.
Here's my code:
html:
<!-- Teams -->
<div class="col-lg-6">
<div class="ibox float-e-margins">
<div class="ibox-content">
<p><h3>Teams Collection</h3></p>
<div class="hr-line-dashed"></div>
<div class="master-teams-table">
<div class="table-responsive" style="overflow-x:initial !important;">
<table class="table table-striped table-bordered table-hover teamsTable" >
<thead>
<tr>
<th class="text-center">Team Name</th>
<th class="text-center">Abbreviation</th>
<th class="text-center">Tower</th>
</tr>
</thead>
<tbody>
{{#each masterAllTeams}}
<tr>
<td>{{team_name}}</td>
<td>{{team_abbreviation}}</td>
<td>{{tower}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- End of Teams -->
Helpers:
UI.registerHelper("masterAllTeams", function() {
return TeamsCollection.find();
});
Thanks for all your help!!