My question is how to get 1 event or rendered callback when a group of elements are updated in the DOM? If I follow the link in the Blaze wiki https://github.com/avital/meteor-ui-new-rendered-callback this is not what I want. If I follow the second recommendation, I will get as many rendered calls as I have elements. And the parent element will only get 1 rendered callback on page load.
In my case, I'm using the Footable Jquery plugin to format a table. The initial load works fine, but if I change a filter variable in the Collection find, the DOM updates and no rendered is called again since Blaze only calls rendered once. I do not want to put the into another template, because that just means multiple calls to rendered and thus multiple calls to Footable when it only needs one for the entire table.
Any help is appreciated.
<template name="customerData">
<table class="table">
{{#each dataRows}}
<tr>
<td>{{first_name}}</td>
<td>{{last_name}}</td>
<td>{{email}}</td>
{{#each phones}}
<td>{{phone}}</td>
{{/each}}
</tr>
{{/each}}
</table>
</template>
Template.customerData.rendered = function(){
$(".table").footable();
}
Template.customerData.phones = function(){
var result = [];
_.each(this.phoneNumbers, function(element, index, list){
result.push({ phone: element});
});
return result;
}