我现在面临一个问题。我有一个包含对象列表的可观察数组。每当我更新数组的任何对象的属性时。它不会反映在浏览器上。我使用了所有淘汰功能,如替换、删除。但是更新出现在可观察数组中,但不在浏览器中。
这是我的问题的示例:
var ViewModel=new {
self=this;
self.List=ko.observableArray([]);
}
$(function(){
ko.applyBinding(ViewModel);
})
$.post('/url',{},function(data){
ViewModel.List(data); //data is list having 4 property having CommentList as again object-->id,title,description,CommentList--->commenttitle,commentdescription
})
//During change of property of commentList
$.post('/updateComment',{},function(obj){//Here obj-->obj.Commenttitle="some title",obj.commentdescription='some description'
//Let say there require update 4th object of List and 2nd property of CommentList
ViewModel.AnswerList()[4].CommentList.splice(2,1,obj);
})
//But nothing updation on browser