我有一个待办事项列表,并且我有与之关联的标签属性。在视图上,我有一个“按标签排序”按钮。当我按下该按钮时,我希望按标签对集合进行排序。现在什么都没有发生。下面是代码。怎么了?
In todos.js I have:
Todos.SortingView = SC.TemplateView.extend({
sortBinding: 'Todos.todoListController.sortTodos'
});
and in todoListController, I have:
sortTodos: function() {
Todos.store.find(Todos.Todo).sortProperty('tag');
}
and in the handlebars view I have:
{{#view Todos.SortingView id="stats"}}
{{#view SC.Button classBinding="isActive" target="Todos.todoListController" action="sortTodos"}}
Sort By Tag
{{/view}}
{{/view}}
{{#collection SC.TemplateCollectionView contentBinding="Todos.todoListController" itemClassBinding="content.isDone"}}
{{view Todos.MarkDoneView}} - Tag - {{content.tag}}
{{/collection}}