jeudi 30 mars 2017

Ember.js component rerender not rerendering

I'm trying to render some data into a table. The data is organized by years, and users can add years to the index.

When the user adds a year, the data for that year is loaded via AJAX and added to an Ember.Object info, like this:

var self=this;
Ember.$.getJSON('url'+year, function(data) {
  var info = self.get("info");
  info['total'][year] = data.total;
  info['commission'][year] = data.commission;
}

In the template, the data is shown via each-in helpers:


  


Following the manual, here, since each-in is not bound to new properties, I added self.rerender(); after the ajax assigments in the component.

My issue is that the component is NOT rerendering. If I change routes and come back, the page is rerendered and the data shows, so the issue is clearly on the rerender() call.

PS: The code shown here is a simplified example; there is a reason why I must use each-in and any solution that necessitates changing the data structure won't help. I just need to know why rerender() is not rerendering and how to make it do so.




Aucun commentaire:

Enregistrer un commentaire