CRM 2015在线更新1:在JavaScript中获取SubGrid行

时间:2016-01-18 18:09:06

标签: javascript dynamics-crm-2015

我尝试了thisthisthis

目标是读取JavaScript中的子网格行,以获取可在以后使用的行的guid。这是在表单的OnLoad中完成的。

这里有几个问题:

  1. 当我使用addOnLoad方法时,它不会在何时调用处理程序 表单是第一次加载。网格必须刷新 或者为它排序以解雇事件。即使我在OnLoad事件中执行代码,它也会在网格中显示零行,尽管Xrm.Page.getControl("Idebarare").getGrid()不为空。
  2. 触发时,getTotalRecordCount返回-1

    Xrm.Page.getControl("Idebarare").getGrid().getTotalRecordCount()

  3. 这是我目前正在使用的代码。在这里,我从表单的onLoad中调用GetContacts

    function GetContacts(){
    
    Xrm.Page.getControl("Idebarare").addOnLoad(myContactsGridOnloadFunction);
    
    
    }
    
    function myContactsGridOnloadFunction(){
    var allGridEntities = [];
    var rows = Xrm.Page.getControl("Idebarare").getGrid().getRows();
    rows.forEach(function (row, i) {
     allGridEntities.push(row.getData().getEntity());
    });
    
    
    }
    

    所以问题是如何从动态CRM 2015 Update 1中的JavaScript中的子网格获取属性/ guid的行?

0 个答案:

没有答案