首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dynamic365CRM统一接口中子网格的重装/刷新形式

Dynamic365CRM统一接口中子网格的重装/刷新形式
EN

Stack Overflow用户
提问于 2020-01-27 11:02:44
回答 3查看 10.2K关注 0票数 0

我有一个场景,在Orders Form中,有一个发票调度子网格。我需要刷新/重新加载主表单,当发票计划子网格上重新加载时,是子网格中的一个特定记录。

P.S:这个场景用于Dynamic365CRM统一接口(UCI)。我已经尝试了所有的三个子网格事件,但在这种情况下没有帮助。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-01-27 19:49:40

您必须附加一个自定义事件处理程序来处理此问题。阅读更多

代码语言:javascript
复制
var globalFormContext;

function myFormOnload(executionContext) {
  globalFormContext = executionContext.getFormContext(); 

  addSubgridEventListener();
} 

function addSubgridEventListener(){
  var gridContext = globalFormContext.getControl("<your_subgrid_name>");
  //ensure that the subgrid is ready…if not wait and call this function again
  if (gridContext == null){
     setTimeout(function () { addSubgridEventListener(); }, 500);
     return;
  }
  //bind the event listener when the subgrid is ready
  gridContext.addOnLoad(subgridEventListener);

}

function subgridEventListener(context){
  globalFormContext.data.refresh(false);
}
票数 2
EN

Stack Overflow用户

发布于 2021-02-02 16:18:54

这段最新的代码在v9统一接口引用:https://learn.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/grids/gridcontrol/addonload中得到验证和工作。

代码片段:

代码语言:javascript
复制
//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);
     }
}

//It triggers onLoad of form, on load and on refresh of subgrid
//as well on add new record and on delete of record it will trigger
function SubgridFunctionExe(){
// here use globalFormContext
  globalFormContext.data.refresh(false);
}
票数 0
EN

Stack Overflow用户

发布于 2021-02-09 08:39:14

对于UCI:从带状按钮,传递参数的PrimaryControl和使用下面的代码刷新。

代码语言:javascript
复制
PrimaryControl.refresh();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59929848

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档