Skip to content

Instantly share code, notes, and snippets.

@mauritslamers
Last active December 29, 2015 04:09
Show Gist options
  • Save mauritslamers/7612980 to your computer and use it in GitHub Desktop.
Save mauritslamers/7612980 to your computer and use it in GitHub Desktop.
GX.itemController = SC.ObjectController.create({
invoiceVatBinding: 'GX.invoiceForItemController.hasVAT',
hasVAT: function(){
return this.get('invoiceVat');
}.property('invoiceVat')
});
GX.invoiceForItemController = SC.ObjectController.create({
contentBinding: "GX.itemController.invoice"
});
//===
GX.Item = SC.Record.extend({
invoice: SC.Record.toOne("GX.Invoice", { inverse: "item" }),
invoiceDidChange: function () {
this.notifyPropertyChange('invoice');
}.observes('invoiceHasVAT'),
invoiceHasVAT: function() {
return this.getPath('invoice.hasVAT');
}.property('invoice').cacheable(), // replacing this by .property('invoice.hasVAT').cacheable() and removing the observer above also throw an error
...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment