Tuesday, May 21, 2024
7
rated 0 times [  14] [ 7]  / answers: 1 / hits: 18692  / 13 Years ago, wed, november 2, 2011, 12:00:00

I have the following problem in Knockout.JS:



Let's suppose that I have an observable array of objects, rendered with the help of a template. Each one of them has two observable properties A and B. Both of these properties take their values from dropdowns (select/options binding).



My problem is that when the selected value of A changes for one object I also want to change the available (and selected) values of B for that specific object. I can't seem to find how this is done using knockout.



I could solve the problem using Javascript or Jquery to assign handlers to the onchange event of dropdown A and change the dropdown options of B manually - however I really don't want to pollute my design with that :(



So please answer me using only knockout's tools...



Thanks !


More From » drop-down-menu

 Answers
60

Take a look at the Cart editor example over at the Knockoutjs website. It includes an example of populating one combo box based on a parent combo box.



http://knockoutjs.com/examples/cartEditor.html



Maybe this helps?


[#89335] Monday, October 31, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
osvaldo

Total Points: 102
Total Questions: 95
Total Answers: 102

Location: Fiji
Member since Wed, Jul 14, 2021
3 Years ago
;