How to force rendering of partial templates


#1

Hi, I am pretty sure this issue has been posted already but I just can’t find a solution…

Let say I have a “chartPage” template, which contains a single “chart” template, all the logic is in the “chart” template so I can also use it in the “chartList” template where all charts are displayed.

When created, the “chart” template is using template’s “this.data._id” to initialize, but when I change chart page it updates all template variables but does not recall the “chart.onCreated()” or “chart.onRendered()” so It does not refresh (execute the logic to initialize) the chart…

If you need code, tell me.
Thanks.


#2

In chart.onRendered use a Tracker.autorun() loop. That will re-run when the reactive data changes and configure your chart again.


#3

@lucfranken Thank you very much, I was using this.data instead of Template.currentData(), my bad… at least you helped me figuring it out ! :slight_smile: