Skip to content

Instantly share code, notes, and snippets.

@lordbron
Created March 21, 2013 18:57
Show Gist options
  • Save lordbron/5215670 to your computer and use it in GitHub Desktop.
Save lordbron/5215670 to your computer and use it in GitHub Desktop.
Weird case where a setter on a binding is not being fired when binding to an object, but does fire when bound to one of its properties.
Fires the setter:
"sampleComponent": {
"prototype": "ui/sample-component.reel",
"properties": {
"element": {"#": "sampleComponent"}
},
"bindings": {
"contentController": {"<-": "@randomItems.content"}
}
},
Does not fire the setter:
"sampleComponent": {
"prototype": "ui/sample-component.reel",
"properties": {
"element": {"#": "sampleComponent"}
},
"bindings": {
"contentController": {"<-": "@randomItems"}
}
},
Here's the serialization code for randome items:
"randomItems": {
"prototype": "montage/ui/controller/array-controller",
"properties": {
"selectObjectsOnAddition": true,
"automaticallyOrganizeObjects": true,
"content": [
{
"id": "ID003",
"order": "1",
"title": "Sample 1"
},
{
"id": "ID002",
"order": "2",
"title": "random text"
}
]
}
},
getter/setter for the contentController
contentController: {
get : function () {
return this._contentController;
},
set : function(value) {
if (this._contentController != value) {
this._contentController = value;
}
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment