Skip to content
Browse files

Added section on 'Bindings and Chained Property Paths' to Core Concepts

  • Loading branch information...
1 parent b6906cc commit 9e5093e8a692862e85acc15bf90b15745b230f38 @wagenet wagenet committed Jan 24, 2011
Showing with 25 additions and 0 deletions.
  1. +25 −0 source/core_concepts.textile
25 source/core_concepts.textile
@@ -401,6 +401,29 @@ instead. In this case the local property (where the binding is defined) will
be updated when the remote property changes, but changes to the local
property will not propagate to the remote property.
+h4. Bindings and Chained Property Paths
+Since bindings make use of observers behind the scenes, the same principles
+of chained observers applies. This means that if you want to observe a
+chained property, you will want to use asterisks in your path as appropriate.
+MyApp.usersController = SC.ArrayController.create({
+ mainUser: SC.Object.create({
+ name: 'Joe'
+ })
+MyApp.userNameView = SC.LabelView.create({
+ valueBinding: 'MyApp.usersController*'
+Since we used an asterisk in the +valueBinding+ property path, the binding
+will be updated if either +mainUser+ or changes.
+h4. Bindings Shorthand
Since bindings are used so often, there's also a shortcut to creating
bindings. All you need to do is append +Binding+ to the property name.
In the above example, you could instead do:
@@ -451,3 +474,5 @@ h3. Changelog
* January 12, 2011: initial partial version by "Peter Wagenet":credits.html#pwagenet
* January 19, 2011: further updates by "Peter Wagenet":credits.html#pwagenet
* January 20, 2011: corrections to "The +init+ Method" and "The Run Loop" by "Peter Wagenet":credits.html#pwagenet
+* January 24, 2011: added section on "Bindings and Chained Property Paths" by "Peter Wagenet":credits.html#pwagenet

0 comments on commit 9e5093e

Please sign in to comment.
Something went wrong with that request. Please try again.