Ryan
Ryan

Reputation: 4414

KnockoutJS observableArray to update when inner observable is changed

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

Upvotes: 5

Views: 3936

Answers (2)

Ryan
Ryan

Reputation: 4414

Ended up using .replace() on the observableArray

Upvotes: 4

Ryan
Ryan

Reputation: 4414

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

RELATED: How to replace a given index element in knockoutjs

Upvotes: 3

Related Questions