简体   繁体   English

Dynamics CRM 2011获取子网格选定的单元格值

[英]Dynamics crm 2011 get subgrid selected cell value

I need to get specific cell value from selected subgrid rows, i've foud a code to attach click event to the subgrid, but it retreive the name or ID fo the row, how to get the cells value?, the code i sue is below : 我需要从选定的子网格行中获取特定的单元格值,我已经找到了将点击事件附加到子网格上的代码,但是它检索了该行的名称或ID,如何获取单元格的值?,我使用的代码是下面:

function ReadSelectedSubGridRecords() {
    if (document.getElementById('Contacts')) {
        var grid = document.getElementById('Contacts').control;
        var ids = grid.get_selectedRecords();
        for (var rowNo = 0; rowNo < grid.get_selectedRecords().length; rowNo++)
            alert(grid.get_selectedRecords()[rowNo].Name);
    }
}

function Form_OnLoad() {
    if (document.getElementById('Contacts')) {
        var grid = document.getElementById('Contacts');
        if (grid.attachEvent) {
            grid.attachEvent('onclick', ReadSelectedSubGridRecords);
        }

    }
    else {
        setTimeout("Form_OnLoad();", 2000);
    }
}

You need to call CRM to retrieve record fields using ID you have retrieved. 您需要调用CRM以使用已获取的ID来检索记录字段。 You may use OData REST endpoint. 您可以使用OData REST端点。 See sample in Dynamics CRM SDK \\SDK\\SampleCode\\JS\\RESTEndpoint\\JavaScriptRESTDataOperations folder. 请参见Dynamics CRM SDK \\ SDK \\ SampleCode \\ JS \\ RESTEndpoint \\ JavaScriptRESTDataOperations文件夹中的示例。

Add all provided libraries to your form and update your code to retrieve needed records. 将所有提供的库添加到表单中,并更新代码以检索所需的记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM