observableArray unclear behavior when replacing
问题 In my ViewModel I have: self.collaps = ko.observableArray([0,0,0,0,0,0,0]); self.shouldShow = function(index) { return self.collaps()[index]; }; My test div: <div data-bind="visible: shouldShow(5)">Shown!</div> I data-bind a button with click: show : self.show = function() { // 1. Index 5 gets true after 2 clicks!!? But UI never updates! self.collaps()[5] = true; // 2. This is push-ing in true starting at index 0 self.collaps.replace(self.collaps()[5], true); // 3. If I combine the two, I get