Reputation: 509
I made a computable observable that read/writes against another observable to sanitize the data. It works well, except that when I update the value many times in a row with an error, after the first time, the value doesn't refresh itself.
Here is a fiddle with the details : http://jsfiddle.net/Spiky/cdxwE/10/
The computed :
this.recommendedValueForDisplay= ko.computed({
read: function () {
return this.recommendedValue();
},
write: function (value) {
this.recommendedValue(formatDollarsToNumber(value));
},
owner: this
}).extend({ notify: 'always' });
In fact, the model value is good (as shown in the simple Div) but the value within the Input box doesn't refresh anymore after first time.
Upvotes: 1
Views: 614
Reputation: 509
I put too much time on this one not to share. The key was putting the .extend({ notify: 'always' }); on the BASE observable also, not only the computed one.
Upvotes: 3