Refresh Content



I’m using the latest versions of Ember and Ember-Data with a small API to learn. I have Ember display a table with elements and there’s an option to delete a record. Delete works fine, except the table doesn’t get updated. I’ve tried with transitionToRoute(‘index’) but nothing happens.


<script type="text/x-handlebars" data-template-name="index">
      {{id}}. {{name}}


App.IndexRoute = Ember.Route.extend({
   model: function() {


App.SampleDeleteModalController = Ember.ObjectController.extend({
  actions: {
    remove: function() {
    	// Two ways

Any idea on how I may get this to work properly?


@xBlack this looks generally correct, but is missing the part of the code that triggers the removal. Could you recreate the issues in a jsbin for us? If you can do that I think the cause could be tracked down pretty quickly.


Inside {{#each}} I have a button:

<button class='btn' {{action 'showModal' 'sample-delete-modal' this}}><i class='fa fa-trash-o'></i></button>

As I said, the action triggers fine and the record is deleted properly. I’m not sure if I can create the jsbin because I’m using the RESTAdapter and because the confirmation button is on a modal, so it’s more complex.

The modal template is:

<script type="text/x-handlebars" data-template-name="sample-delete-modal">
  {{#my-modal title='Delete Record' ok='remove' close='removeModal'}}
    <p>Delete <b>{{name}}</b>?</p>

Isn’t there something I have to do after the delete to refresh or re-render the table?



Here is an attempt to build it in jsbin.

Didn’t really work with my modal setup, but it’s much simpler this way.

Also, I’m using destroyRecord() in my app, and it does delete the record, but here doesn’t work.


The remove action in the jsbin was already sending the sample, you can just call destroyRecord on that:

Maybe you need to evolve the bin more to get closer to your original issue? This was a pretty easy thing to clean up, take a look.


I’m using the bootstrap modal to ask for confirmation before deleting. I can’t get the modal to work on jsbin or jsfiddle. But this is the idea: and maybe it helps. Thanks a lot mixonic.


I haven’t been able to fix this problem. Moreover, today I run into a similar issue. I have a search box where a user can enter something and search. It works fine the first time, but the second the view does not get refreshed but I can see the data coming if I use {{log this}}. Obviously, I must be doing something wrong. (It works if I have the Ember Extension open - I guess it forces the refresh).

The workflow of this is as follows: From the Index go to Client. Here there is an search box. Enter something and press a button. Button has action ‘search’ which is defined in ClientController which does transitionToRoute(''). The route only has

model: function(params) {
    return'client', { name: params.keyword, limit: 25, orderby: 'id desc' });

What am I missing? Why is the data retrieved but the view not updated? (I’ve already tried to create a jsbin with this, but I can never get it to work at all.)


I solved this problem by adding an empty route:

App.ClientLoadingRoute = Ember.Route.extend();

Can anyone explain why this fixes the issue? I was able to find the solution after noticing that if I opened Ember Inspector and clicked on the Routes tab, the search would magically work.