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

时间:2011-11-25 16:30:33

标签: c# javascript jquery dynamics-crm-2011

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

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

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

谢谢!

2 个答案:

答案 0 :(得分: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();

答案 1 :(得分:3)

如果有人来这里参加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();
                         });
    }