i'm having some trouble with the handlebars template not updating every time the contents of this component's 'subAllocations' change. it does change the first time the event is triggered ie adding or removing subAllocations, but not after that, even though i can see in the Ember debugger addon for FireFox developer tools that the computed value has changed for 'hasSubAllocations'
App.AllocationAllocationRowComponent = App.CollapsableComponent.extend({
layoutName: 'components/allocation/allocation/row',
tagName: "tr",
hasSubAllocations: Em.computed.notEmpty("allocation.subAllocations"),
updateAllocation: function (data) {
var newAllo = data.allocation;
this.set("allocation.subAllocations", Em.copy(newAllo.subAllocations));
this.sendAction("onRefreshAirSpaces", data.updatedAirSpaces);
},
actions: {
addSubAllocation: function(){
var alloc = this.get("allocation");
var self = this;
Em.$.ajax({
type: 'POST',
url: '/allocation/addSubAllocations',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(alloc),
}).then(function (data) {
self.updateAllocation(data);
});
},
subAllocationRemoved: function (subAllocation) {
var self = this;
Ember.$.ajax({
type: 'POST',
url: '/allocation/RemoveSubAllocation/',
contentType: 'application/json',
dataType: 'json',
data: JSON.stringify(subAllocation),
}).then(function (data) {
self.updateAllocation(data);
});
},
},
});
from handlebars template
`<span {{bind-attr class="hasSubAllocations:hidden:"}}>content here</span>`
am i missing something?
we are not using ember data, so if you could avoid suggesting that as a solution that would be great