I have a nested component and I needed it to rerender on occassion. First of all I tried to simply call the rerender method:
modelUpdated: function() {
this.rerender();
}
But I got this error message:
You can't use appendChild outside of the rendering process
The solution was to use the run loop but I'm confused as to why this works:
modelUpdated: function(model){
Ember.run.scheduleOnce('render', this, 'rerender')
}
My understanding of scheduleOnce
is that it will create a run loop if one does not exist and I the rerender
method will be executed once in the render queue of the runloop.
I'm confused as to why this would go in the render queue and an explanation would be great.
Aucun commentaire:
Enregistrer un commentaire