javascript - Knockout Observable not updating when given a new value -


this seems basic part of using knockout, , i'm not sure why isn't working, reason , 2 of 5 knockout observables holding onto new values.

in setup of model:

self.cprovideridentifier = ko.observable(); self.referringprovideridentifier = ko.observable(); self.billablecareprovideridentifier = ko.observable(); self.servicelocationidentifier = ko.observable(); self.practicelocationidentifier = ko.observable(); 

inside of ajax call returns number of items inside of json object, extract relevant pieces of information, , put them correct observable:

visitmodel.cprovideridentifier(data.careprovideridentifier); visitmodel.referringprovideridentifier((data.referringprovideridentifier == null ||   data.referringprovideridentifier == "undefined") ? 0 : data.referringprovideridentifier); visitmodel.billablecareprovideridentifier(data.billablecareprovideridentifier); visitmodel.practicelocationidentifier(data.practicelocationidentifier); visitmodel.servicelocationidentifier(data.servicelocationidentifier); 

now, if none of them worked, make (some) sense, cprovideridentifier , referringprovideridentifier have no data. i've checked data in break point right before getting setting properties, , values data 1003 , 0, 2 observables undefined above block of code.

i'm working on getting fiddle working this: https://jsfiddle.net/bz3mq6z9/

the assignment made in loaddata function. inside it, javascript not know visitmodel. variable not exist , not have purpose in setter.

use self instead of visitmodel. way knockout knows assigning values view model

greetings


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -