我如何刷新实体主页视图上的列表

问题描述 投票:1回答:2

我在一个CRM 2011实体上有一个自定义功能区按钮,可以有效地禁用该实体。

然后,我想刷新该实体主页上的当前视图。我想由JS触发。

当前,我能够刷新整个父窗口,这将使我回到仪表板而不是该实体的主页。

谢谢!

c# javascript jquery dynamics-crm-2011
2个回答
4
投票

好问题。您可以通过以下两种方式进行操作:

//refreshes the entire element in the parent window that contains the view
window.parent.opener.location.reload();

//refreshes just the grid control that contains the view (probably what you're looking for)
window.parent.opener.document.getElementById("crmGrid").control.refresh();

0
投票

如果有人要来这里使用Dynamics 365

对自定义功能区按钮执行以下操作:

  • PrimaryControl作为CrmParameter添加到您的JS函数中
  • 使用以下代码刷新列表:
    function yourJSFunction(primaryControl) {
        // Do your stuff
        primaryControl.refresh();
    }
    

    Xrm.WebApi.online.executeMultiple(...)的示例:

    function yourJSFunction(primaryControl) {
        // Create the requests
        // ...
    
        Xrm.WebApi.online.executeMultiple(requests)
                         .then(function (result) {
                             primaryControl.refresh();
                         });
    }
    
  • © www.soinside.com 2019 - 2024. All rights reserved.