I am trying to make a table with collapsible rows using knockout. Each "parent" row exists at the top level of my data structure, and each "child" row is an element of a member array.
The problem comes when I update the data from the server. The data updates, but I can tell it is replacing my DOM objects because a checkbox in the "parent" row is getting cleared. I have a fiddle that demonstrates this problem, using a timer to update the data:
http://jsfiddle.net/jdlogicman/m2LWk/
I have read that using a nested foreach instead of {{each}}
should fix it, but I can't get that to work - please see the commented-out section in the above fiddle.
If any existing question addresses this, I couldn't tell how. Any help is appreciated
You are not storing the value of the checkbox so it does get cleared each time. Does the fiddle below solve your problem?
http://jsfiddle.net/unklefolk/RYqTT/