最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - KnockoutJS observableArray to update when inner observable is changed - Stack Overflow

programmeradmin6浏览0评论

I need to know how to trigger the update for an observableArray when an observable is changed inside the observableArray.

I have an observableArray that represents a binary tree. I'm using a storage mapping function to get and set the values in the array so it has to be balance even thought it might only contain an empty observable. E.g. nodes()[9] maybe null but when that node is updated I would call nodes()[9](set new value) and need to trigger the observableArray to update

I need to know how to trigger the update for an observableArray when an observable is changed inside the observableArray.

I have an observableArray that represents a binary tree. I'm using a storage mapping function to get and set the values in the array so it has to be balance even thought it might only contain an empty observable. E.g. nodes()[9] maybe null but when that node is updated I would call nodes()[9](set new value) and need to trigger the observableArray to update

Share Improve this question asked Jan 8, 2012 at 2:33 RyanRyan 4,4143 gold badges45 silver badges82 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 4

Ended up using .replace() on the observableArray

Managed to look through the code and find observableArray.replace ()

RELATED: How to replace a given index element in knockoutjs

发布评论

评论列表(0)

  1. 暂无评论