Knockout isDirty example, using dynamic viewmodule from mapping plugin

给你一囗甜甜゛ 提交于 2019-12-06 12:33:36

You could add the dirtyFlag to the ProfilePropertyValue like:

var mappingOptions = {
    ProfilePropertyValue: {
        create: function (mappingoptions) {
            var data = mappingoptions.data;
            data.ProfilePropertyValue = data.ProfilePropertyValue || {
                "ID": null,
                    "Checkbox": ko.observable(false)
            };

            var result = ko.mapping.fromJS(data);
            result.dirtyFlag = ko.dirtyFlag(result);

            return result;
        }
    }
};

Then, you would need to check it when building your list of dirty items, if that is something that you need.

Sample: http://jsfiddle.net/rniemeyer/7DGfs/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!