Hi,
I have struggled quite some time with this before I found a working solution. The problem exists only in older IE browsers like IE8, you can replicate it in IE9-10 in compability mode.
If you look at my fiddles below you can see that I have a simple observableArray that is used to render LI in a UL.
Then I use jQuery sortable on the UL to enable drag and drop sorting of the list, and in the sortable update method moves the item in the observable array.
Fiddle 1 works good in all browsers I have tested without using a template like in fiddle 1, but I need templates...
In fiddle 2 it doesn't work in <IE8. Binding like this:
<ul class="sortable" data-bind="template: {name: 'Item', foreach: items}">
In fiddle 3 it works in all browsers. Binding the template like this instead:
<ul class="sortable"
data-bind="foreach: items">
<!-- ko
template: {name: 'Item', data: $data} -->
<!-- /ko -->
</ul>
1. Working without template:
2. Not working with template:
3. Working with template:
Note! The problem only exists when the item is dragged using jQuery sortable. If you press the "Move last item first" (moved in array using splice) all of the fiddles work in IE8.
Can anyone tell me if I'm doing something wrong in fiddle 2.
I see no drawbacks by using templates like in fiddle 3, but still interested hearing what you think.