Dynamics CRM 2015通过FetchXML应用自定义子网格(getElementById(“ selectedGrid”)返回null) [英] Dynamics CRM 2015 Applying custom subgrid with FetchXML (getElementById(“selectedGrid”) returns null)

查看:106
本文介绍了Dynamics CRM 2015通过FetchXML应用自定义子网格(getElementById(“ selectedGrid”)返回null)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft Dynamics CRM 2015内部版本。

I am using Microsoft Dynamics CRM 2015 on-premise version.

我正在使用JavaScript将自定义FetchXml应用于子网格。

I am applying a custom FetchXml to a subgrid using JavaScript.

这里的问题是document.getElementById( selectedGrid)返回null。

The issue here is document.getElementById("selectedGrid") returns null.

我读过文章说,2015年不再支持此方法版本。

I read articles says that this method is not supported anymore in 2015 Version.

我的问题:此方法还有其他选择吗?

My question: is there any alternative to this method?

推荐答案

这对我有用,实际上我也已经可以使用document.getElementById。如果您要添加事件或其他事件(并将其关联到onLoad),只需确保设置了超时时间,因为网格会在页面加载后通过iframe加载,因此可能会有一些延迟。我针对机会表格中存在的数据网格运行了以下脚本(此JS已挂入onsave),并且每次都获得找到控件。

This works for me, and in fact I've been able to use document.getElementById as well. If you're adding an event or something (and hooking it to onLoad), just make sure you set a Timeout because grids get loaded in via iframes after the page itself loads, so there may be some delay. I ran the below script against a datagrid that exists on our Opportunity form (this JS was hooked to onsave), and was getting "Control Found" every time.

function test()
{
    var control = Xrm.Page.getControl('grid_name');

   if (control == null)
    {
    console.log("Control not found.");
    //setTimeout(setTimeout(function() { test(); }, 3000));
    }
    else
    {
        console.log("Control found.");
    }
}

这篇关于Dynamics CRM 2015通过FetchXML应用自定义子网格(getElementById(“ selectedGrid”)返回null)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆