I’m trying to set up a simple Item system where only one Item can be selected at a time. If you select an item, the previously selected one should be deselected.
App.ItemController = Ember.ObjectController.extend({
selected: false,
actions: {
select: function() {
this.set('selected', true);
//now I want to .set('selected', false) to all other Items.
}
}
});
App.ItemsController = Ember.ArrayController.extend({
//Do I need this Items Array controller to accomplish this?
//If so, how would I deselect them all here?
});
I’m not sure exactly how to access sibling ItemControllers or how to have the array ItemsController affect all its children.
Another option I considered was using ‘selected’ as an attribute on the model, but without the DS so that detail doesn’t touch the server. Though, it feels a little unneccessary to clutter up the model for a state thing like this.
Thanks a ton for any help,
Drew