【问题标题】:Problem with Reload Form on reload/refresh of subgrid in Dynamics 365 CRM Unified Interface在 Dynamics 365 CRM 统一接口中重新加载/刷新子网格时重新加载表单的问题
【发布时间】:2020-08-31 23:22:19
【问题描述】:

我的情况与此线程完全相同: Reload Form on reload/refresh of subgrid in Dynamics 365 CRM Unified Interface

不幸的是,建议的解决方案对我不起作用。唯一一次调用“subgridEventListener”方法是在表单加载时。如果我从子网格中添加或删除记录,则不会发生任何事情..

有没有人可以解决这个问题?

统一接口。 2019 年发布 Wave 2 启用服务器版本:9.1.0000.16843 客户端版本:1.4.583-2004.2 –

【问题讨论】:

  • 你调试了吗?那么事件处理程序附加到事件但不触发子网格重新加载事件?您可以添加您正在使用的 sn-p 吗?

标签: refresh reload dynamics-365 subgrid


【解决方案1】:
//On load of main form event
function OnloadOfMainForm(executionContext) {
// call onLoad of subgrid function
  SubgridEventHandler(executionContext);
} 

var globalFormContext;
function SubgridEventHandler(executionContext){
//make formContext as global
  globalFormContext = executionContext.getFormContext(); 
  var gridContext = globalFormContext.getControl("subgrid_name");

  //Verify the subgrid is loaded, if not recursively call function again
  if (gridContext != null && gridContext != undefined){
      //don't try to pass formEontext some time it doesn't works
      gridContext.addOnLoad(SubgridFunctionExe);
     }else{
        setTimeout(function () { SubgridEventHandler(); }, 200);
     }
}

//Perform operation onLoad of form and subgrid, on refresh of subgrid it will trigger
//as well on add new record and on delete of record it will trigger
function SubgridFunctionExe(){
// here use globalFormContext
  globalFormContext.data.refresh(false);
}

参考:https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/grids/gridcontrol/addonload

【讨论】:

  • 虽然此代码可能会回答问题,但提供有关它如何和/或为什么解决问题的额外上下文将提高​​答案的长期价值。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-08-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多