HTML客户端:originalValue =未定义 [英] HTML Client: originalValue = undefined

查看:120
本文介绍了HTML客户端:originalValue =未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在客户端JavaScript更改监听器中比较新旧值.每次我检查contentItem.originalValue时,它都是未定义的.该属性在那里,只是未设置.有什么想法吗?

I want to compare old and new values in a client-side JavaScript change listener.  Every time I check contentItem.originalValue it is undefined.  The property is there it's just not set.  Any ideas?

这是SL客户端的方法:

This is the way for SL client:

TIA,

乔什

推荐答案

我也没有看到使用过originalValue.在dataBind函数中,contentItem在范围外,但作为 仍保留对其原始数据的引用.

I haven't seen originalValue used either. In the dataBind function contentItem is out-of-scope but is passed as this which still keeps a reference to its original data.

以屏幕属性名字"为例:

As an example for a screen property Firstname:

myapp.AddEditEngineer.Firstname_postRender = function (element, contentItem) {
    // Write code here.
    contentItem.dataBind('value', function (newValue) {
        if (this.bindingSource.data.Firstname === this.value)
            console.log('No changes');
        else {
            console.log(newValue);
        }
    });
};

...将区分新值和原始值.

...will distinguish between a new and original values.


这篇关于HTML客户端:originalValue =未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆