如何使用其中的函数更新 kendo.observable 对象使用的数据?剑道用户界面
问题是我的员工姓名没有更新为新值。当第一次页面点击时,它会绑定正确的值,但在更新名称后,它不会使用更新后的员工姓名进行更新。 EmpdataSource正在更新,但函数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
}
},
});
我们如何在每次数据更新时更新employeename函数?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
您需要在绑定函数中使用 get() 以便更改触发绑定更新。
Try this:
You need to use get() in bound functions in order for changes to trigger a binding update.