Take the 2-minute tour ×

I'm referring to this example


In the code they clear the list by filtering and then removing from the collection

clearCompletedTodos: function() {
    this.filterProperty('isDone', true).forEach(this.removeObject, this);

Suppose I wish to apply the same filter but I want to toggle rather than remove. In other words some type of 'Hide Done' button. If checked it would hide all of the done tasks. If unchecked it would show all of the done tasks. How would I do this?

share|improve this question
you can try some $("isDone").hide() –  Torrent Lee Apr 18 '12 at 1:06
add comment

1 Answer

up vote 4 down vote accepted

You can create something along this lines, see http://jsfiddle.net/pangratz666/rufjC/


{{#each todos}}
    {{#view App.TodoView todoBinding="this" }}
        {{view Ember.Checkbox valueBinding="todo.isDone" titleBinding="todo.label" }}


App.TodoView = Ember.View.extend({
    hideTodosBinding: 'App.hideTodos',
    isDoneBinding: 'todo.isDone',
    isVisible: function(){
        return !(this.get('hideTodos') && this.get('isDone'));
    }.property('hideTodos', 'isDone').cacheable()
share|improve this answer
add comment

Your Answer


