D365 CRM 如何使用queryselectorall()访问子网格单元DOM

问题描述 投票:0回答:0

我的客户需要这个功能,我对 CRM 定制非常陌生,我主要做后端,所以插件自定义操作和自定义 api。下面的所有 3 个代码始终返回 null。我做错了什么。

function myGridClickHandler(executionContext) {

let formContext = executionContext.getFormContext(); 
let gridContext = formContext.getControl("Document_Barcodes2"); 
let grid = gridContext.getGrid();
let myContactsGridOnloadFunction = function() {
    console.log("Document_Barcodes2 Subgrid OnLoad event occurred");

  
   let elements = window.parent.document.querySelectorAll("div.ag-cell"); 
   let elements2 = document.querySelectorAll("div.ag-cell"); 
   let elements3=document.querySelectorAll('.ag-cell[col-id="ct_preview"]');
     debugger;  
    
    }
  gridContext.addOnLoad(myContactsGridOnloadFunction);



         
}

The page and subgrid, it's the second one

The id,class... of the element i need to select

javascript dom frontend dynamics-crm queryselector
© www.soinside.com 2019 - 2024. All rights reserved.