mardi 16 juin 2015

sortable list in emberjs

i have loaded a list from server into handlebar. when the list order changes, i need to send the sorted order back to the server. to make a list sortable, i have used jquery-ui.js. when i change the list order by dragging and dropping the list, visually the list order changes. but it is not changed inside the controller data.

application.hbs:

<ul>
    {{#each lists as |list|}}
        <li>{{list.name}}</li>
    {{else}}
        <!--   Empty data handling     -->
    {{/each}}
</ul>

application.js

var List = [{name:'list1'}, {name:'list2'}, {name:'list3'}];
var Controller = Ember.Controller.extend({
  lists : Lists,
});

i can't find, how to make the controller data to change when the list order changes. just point me in the right direction.




Aucun commentaire:

Enregistrer un commentaire