• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
返回主页

TheMiao

  • 博客园
  • 首页
  • 新随笔
  • 联系
  • 订阅
  • 管理

计算当前页面和editable subgrid(可编辑子网格)中的值

开发当中想必大家都遇到过了在editable subgrid子网格中添加值保存之后需要在页面中计算.

 

如果只有1-2个字段,我们可以使用rollup, 但是如果字段多了  只用rollup就不现实, 我们可以使用formContext.data.refresh(save).then(successCallback, errorCallback);

我们可以建一个bool field字段绑定以下代码

        this.RefreshLabel = function (executionContext) {
            var formContext = executionContext.getFormContext();
            var booleanfield = formContext.getAttribute("booleanfield");
            if (booleanfield !== null && booleanfiled.getValue() === true) {
                formContext.data.refresh(true).then(
                    function success(result) {
                        booleanfield.setValue(false);
                    },
                    function (error) {
                        Xrm.Navigation.openAlertDialog({ text: "Refresh Failed", title: "Notification" }).then(function success(result) {
                            booleanfield.setValue(false);

                        });
                    });
            }
        };

 

posted @ 2020-03-01 12:44  TheMiao  阅读(242)  评论(0)    收藏  举报
刷新页面返回顶部

公告

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3