Note that there are some explanatory texts on larger screens.

plurals
  1. POsubscribing to observables to update viewmodel
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/tim3046/jtmY3/2/" rel="nofollow">http://jsfiddle.net/tim3046/jtmY3/2/</a></p> <hr> <p>I got the observables to partly work since it updates the top par string.</p> <p>This is what im subscribing to so im wondering if maybe this part is wrong since when i add a golfer it has the currently selected course par. (ie) I can have 2 golfers on one course and 3 on another so when the radio button is hit the only thing its doing is changing the par for the next golfer to be added.</p> <pre><code>self.site.subscribe(function (newValue) { var len = self.golfers().length; for (var i = 0; i &lt; len; i++) { self.golfers()[i].par(self.availableCourses()[self.site()].courseP); } }); </code></pre> <p>and here is where i have my available courses</p> <pre><code>self.availableCourses = ko.observableArray([ { name: ko.observable("Fort Cherry Golf Club"), courseP: [ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(5), ko.observable(3), ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(3), ko.observable(4), ko.observable(5), ko.observable(4), ko.observable(3), ko.observable(4), ko.observable(4)] }, { name: ko.observable("Lake View Golf Course"), courseP: [ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(3), ko.observable(5), ko.observable(4), ko.observable(5), ko.observable(3), ko.observable(4), ko.observable(4), ko.observable(4), ko.observable(3), ko.observable(4), ko.observable(5), ko.observable(4), ko.observable(3), ko.observable(4), ko.observable(5)] } ]); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload