I have updated my website to the latest JQuery, JQueryUI and KnockOutJS.
Since then my accordion refuses to update when I add items to my observerable array. This works just fine when using KnocKOutJS version 2.0.0 with older versions for JQuery.
I have recreated the problem in JSFiddler and would appreciate any help. The javascript is a heavily simplified version of my actual code.
http://jsfiddle.net/glenb/M9222/6/
Any assistance would be greatly appreciated. My Model looks like this:
function ModelCollection() {
var self = this;
self.ModelItems = ko.observableArray([]);
self.AddNewItem = function(){
var newItem = new ModelItem();
newItem.Name = "Added";
modelCollectionApp.ModelItems.push(newItem);
};
}
function ModelItem() {
var self = this;
self.Name = "";
}
The HTML:
<div id="knockOutBinding">
<div data-bind="foreach: ModelItems, jqAccordion: {}">
<h3>An Element Title</h3>
<div>Some Content</div>
</div>
<button data-bind="click: AddNewItem">Add New Item</button>
</div>
Finally I initially populate it and bind it
var modelCollectionApp = new ModelCollection();
var modelItem = new ModelItem();
modelItem.Name = "test1";
modelCollectionApp.ModelItems.push(modelItem);
var modelItem = new ModelItem();
modelItem.Name = "test2";
modelCollectionApp.ModelItems.push(modelItem);
ko.applyBindings(modelCollectionApp, document.getElementById("knockOutBinding"));