1

Is there an event that gets fired when the template changes based on the data change?

I noticed that the Template.foo.rendered is fired only once, and I would like to catch the re-render event if possible...

Also, from the Meteor documentation and also from this SO answer, it seams that we should use onRendered instead of rendered for Meteor 1.0.4 and higher, but I am using Meteor 1.2.1 and the onRendered simply does not fire, while rendered does just fine :(

Community
  • 1
  • 1
Predrag Stojadinović
  • 3,439
  • 6
  • 34
  • 52

1 Answers1

3

I once had similar need as you describe, it took some time to figure it out. (I have described the story with rendered and onRendered here)

In short - rendered fires only once, when component is first rendered. Which is fine until, I want to remove and add back some parts of it dynamically. Solution I found was, that my big template had to be split into smaller chunks, each defined as its own template. Then when adding or removing those smaller chunks, reactivity would do its job and rendered would be called on each template, on each dynamic adding or removal.

I hope that this gives you an idea how to work around this issue, as there is no re-rendering event available in Meteor.

Martins Untals
  • 2,128
  • 2
  • 18
  • 31