Skip to content

Instantly share code, notes, and snippets.

@MikailCliftov
Created May 16, 2011 18:17
Show Gist options
  • Save MikailCliftov/974993 to your computer and use it in GitHub Desktop.
Save MikailCliftov/974993 to your computer and use it in GitHub Desktop.
MyApp.aSimpleController= SC.ObjectController.create({
contentBinding : SC.Binding.single('MyApp.anArrayController.selection')
});
MyApp.anotherArrayController= SC.ArrayController.create({
abcBinding: 'MyApp.aSimpleController.content',
xyzBinding: SC.Binding.oneWay('MyApp.anotherObjectController.content'),
observeMe: function(){
var abc= this.get('abc');
var xyz= this.get('xyz');
if (abc && xyz ){
console.log('abc: '+abc);
console.log('xyz: '+xyz);
console.log('abc should be: '+ MyApp.anArrayController.get('selection').firstObject);
}
}.observes('abc', 'xyz')
});
'abc' seems to lag behind.
In some situations when abc should be undefined, it is set to the previous value;
output:
abc: MyApp.bla bla
xyz: MyApp.bla bla
abc should be: MyApp.bla bla
//selection set is changed to empty
abc: MyApp.bla bla
xyz: MyApp.bla bla
abc should be: undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment