When I include a foreach binding of my observableArray twice on my page, the numbers on the ordered list all show 1 when adding objects to the array
<ol data-bind="foreach: Participants">
<li>
<span data-bind="text: email"> </span>
</li>
</ol>
and it shows as follows:
1. test1@test.com
1. test2@test.com
When I hide the div containing the ol and show it back, the numbers get updated and show the correct values
If the foreach binding is included only once, everything works fine and the numbers get updated while I am adding to the array.
1. test1@test.com
2. test2@test.com
Is this a bug or am I missing something?
Edit: This actually happens only in IE when the second div is hidden
here is a fiddle demonstrating the problem http://jsfiddle.net/c4Hc8/
I strongly believe now that this is a bug in Knockoutjs.
For anyone experiencing the same issue, I fixed this by replacing
display:none;of my div withvisibility:hidden;The following fiddle shows that the numbers in the
<ol>are updated correctly with this fix http://jsfiddle.net/c4Hc8/1/