julitrows
julitrows

Reputation: 30

Ember.js view not being autoupdated

I'm stuck in the 'Scrumptious' bookmark app created in a Tuts+ Course called 'Let's Learn Ember'. As the course is some months old, I'm trying to re-do the app using the most updated versions of Ember.js and Ember-Data.

Here's the repo: https://github.com/jantequera/scrumptious

NOTE: due to @claptimes request, I've added a jsbin of the project: http://jsbin.com/ukuDORUZ/2/edit?html,js,console

The thing is, that in the 'bookmarks' template, when I add a new bookmark, it is stored and the "create Bookmark" partial disappears, but the bookmarks table isn't updated, and it doesn't even reflect the changes in the newly created bookmark on real-time, which is the intended behaviour. In other words, I have to refresh the browser in order to see the new bookmark in the table, which is not the way an ember.js app should work.

As I am learning Ember, I might have missed or misunderstood something in the guides that explains this, so any help is welcome. Below I expose the code, if you wish to see it in context or even try it out, use the repo above. Thanks!

EDIT Anton below pointed out and advised the usage of components, which make the jsfiddle above work. However, when I use this solution in my local copy, it wouldn't work UNLESS I use the FixtureAdapter INSTEAD of the LSAdapter (local-storage). Any clue?

Upvotes: 0

Views: 105

Answers (1)

Anton Lantsov
Anton Lantsov

Reputation: 336

http://jsbin.com/ukuDORUZ/6

You use "render" helper:

{{render "table" controller.regular}}

model is not updated in "table" template when you create new bookmark and update controller.regular

you can use component (http://emberjs.com/guides/components/) and bind your model to component's parameter:

{{bookmarks-table elementsBinding="controller.regular"}}

http://jsbin.com/ukuDORUZ/6

Upvotes: 2

Related Questions