Permalink
Browse files

Merge branch 'master' of github.com:sproutcore/sproutguides

  • Loading branch information...
2 parents 3158547 + 904d3ee commit 5d116df2ffbfcfed2e1e6cb02abb82929988d218 @wycats committed Feb 2, 2011
Showing with 507 additions and 3 deletions.
  1. +3 −1 .gitignore
  2. +1 −1 README.md
  3. +26 −1 source/core_concepts.textile
  4. +477 −0 source/views.textile
View
@@ -1,2 +1,4 @@
-output
.DS_Store
+.bundle
+bin
+output
View
@@ -12,7 +12,7 @@ In order to start generating documentation, complete the following steps:
- install the [SproutGuides package](http://guides-pkg.strobeapp.com/Guides.pkg)
- clone SproutGuides from git://github.com/sproutcore/sproutguides.git
-- cd into sproutguides and run `guides generate` to generate the output directory
+- cd into sproutguides and run `guides build` to generate the output directory
Once you've completed these steps, you're ready to start working with
SproutGuides. You'll do your work inside the source/ directory. As you make
@@ -299,7 +299,7 @@ i.e. +this.notifyPropertyChange('value')+.
In some cases you may find that you are updating a number of properties at
once. If you have a lot of observers that depend on these properties, you
may find them getting called more often than necessary. In this case, you
-can use +beingPropertyChanges+ and +endPropertyChanges+ to wrap the your
+can use +beginPropertyChanges+ and +endPropertyChanges+ to wrap the your
property change calls. This will cause all change notifications to happen
once +endPropertyChanges+ is called and will prevent unnecssary duplicate
notifications.
@@ -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.
+
+<javascript>
+MyApp.usersController = SC.ArrayController.create({
+ mainUser: SC.Object.create({
+ name: 'Joe'
+ })
+});
+
+MyApp.userNameView = SC.LabelView.create({
+ valueBinding: 'MyApp.usersController*mainUser.name'
+});
+</javascript>
+
+Since we used an asterisk in the +valueBinding+ property path, the binding
+will be updated if either +mainUser+ or +mainUser.name+ 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
+
Oops, something went wrong.

0 comments on commit 5d116df

Please sign in to comment.