vendredi 15 janvier 2016

Ember destroyRecord() doesn't refresh view after drag'n'drop

I'm using http://ift.tt/JyX1Kw as a sortable plugin to reorder my Widget models. Here is a render of models

{{#sortable-list}}
  {{#each model.page.pageWidgets as |pageWidget|}}
    <div class="widget-item">
      <div class="btn-group">
        <a class="btn-floating handle"><i class="material-icons">open_with</i></a>
        <a {{action 'destroyWidget' pageWidget}} class="btn-floating red"><i class="material-icons">delete</i></a>
      </div>
      {{{pageWidget.widget.html}}}
    </div>
 {{/each}}
{{/sortable-list}}

Sortable component code:

App.SortableListComponent = Ember.Component.extend({
  initSort: (->
    Sortable.create $('#sortable')[0], {
      handle: '.handle'
      draggable: '.widget-item'
    }
  ).on('didInsertElement')
})

If I add two widgets on the page, switch them by drag'n'drop action and click on delete button, I still see my rendered list of Widgets. But Ember Inspector says that models were destroyed. Any ideas?




Aucun commentaire:

Enregistrer un commentaire