gpt4 book ai didi

javascript - Dynamics CRM 2015 Online : SubGrid's control. SetParameter 方法不可用

转载 作者:行者123 更新时间:2023-12-01 16:00:33 27 4
gpt4 key购买 nike

我正在尝试使用 CRM 2015 在线的 fetchXml 结果填充子网格。一开始的一个问题是 document.getElementById("leadUmbrellaGrid"); 返回 null

function filterSubGrid() {

var leadwithSameNameGrid = Xrm.Page.getControl("leadUmbrellaGrid").getGrid();//HAVE TRIED window.parent.document.getElementById("leadUmbrellaGrid"); //grid to filter
var currentleadId = Xrm.Page.data.entity.getId();;
if (leadwithSameNameGrid == null) {

setTimeout('filterSubGrid()', 500);
return;
}
//fetch xml code
var fetchXml = "<fetchxml goes here>";


leadwithSameNameGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml

}

我已经经历了thisthis

我也尝试了 window.parent.document.getElementById 但在这两种情况下,.control 都是 null 或 undefined 并以:

类型错误:无法获取未定义或空引用的属性“SetParameter”

非常感谢您的帮助/提示。谢谢,

最佳答案

解决方法如下:

  1. 我们需要使用window.parent.document.getElementById

  2. 等待 control 加载到 DOM 中。

所以代码看起来像这样:

function filterSubGrid() 
{

var leadwithSameNameGrid = window.parent.document.getElementById("leadUmbrellaGrid");
var currentleadId = Xrm.Page.data.entity.getId();;
if (leadwithSameNameGrid == null)
{
setTimeout(filterSubGrid, 500);
return;
}

//fetch xml code
var fetchXml = "<fetchxml goes here>";
if (leadwithSameNameGrid.control != null)
{
leadwithSameNameGrid.control.SetParameter("fetchXml", fetchXml); //set the fetch xml to the sub grid
leadwithSameNameGrid.control.refresh(); //refresh the sub grid using the new fetch xml
}
else
{
setTimeout(filterSubGrid, 500);
}
}

关于javascript - Dynamics CRM 2015 Online : SubGrid's control. SetParameter 方法不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32564310/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com