Hi there,
I am fetching a list of objects with Ember-Data within the model hook of a route. Each object (‘item’) has a property ‘checked’ (checked: DS.attr(‘boolean’, { defaultValue: false }),) Then I put the list as ‘list’ to the controller. In template I loop through the list and display the records while adding the ability to check/uncheck an item. {{input type=“checkbox” checked=item.checked}} How do I observe if one or more items in my list got checked inside my controller in order to enable a - lets say - action button?
updated: function () { Ember.Logger.info(“Beep!”); }.property(‘list.@each.checked’)
does not get fired.
TIA,
Martin
P. S.
This works:
// ---------------------------------------------------------------------------
isActionButtonDisabled: function () {
var disabled = true;
var enumeration = this.get('list').map(function (item, index, enumerable) {
if (item.get('checked')) {
disabled = false;
}
});
return disabled;
}.property('list.@each.checked'),