Reputation: 93
Issue is my employeename is not updating with new values. When first time page hits it binds the correct value but after updating the name it does not update with updated employeename. EmpdataSource is updating but not function employeename
<div><ul> <li><span class="name"
data-bind="text: employeename" ></span></li></ul></div>
var viewModel = kendo.observable({ EmpdataSource: ActPst[ID].ptdata, employeename: function () {
if (ActPst[ID].ptdata.data()[0].id < 0) {
return ''
} else {
return ActPst[ID].ptdata.data()[0].id
}
},
});
How can we update the employeename function in everytime the data gets updated?
Upvotes: 1
Views: 167
Reputation: 8490
Try this:
if (this.get("ActPst[ID].ptdata.data()[0].id") < 0) {
return ''
} else {
return this.get("ActPst[ID].ptdata.data()[0].id")
}
You need to use get() in bound functions in order for changes to trigger a binding update.
Upvotes: 1