title | description | author | ms.author | ms.date | ms.reviewer | ms.topic | applies_to | search.audienceType | contributors | ||
---|---|---|---|---|---|---|---|---|---|---|---|
gridContext.addOnLoad (Client API reference) in model-driven apps| MicrosoftDocs |
Includes description and supported parameters for the gridContext.addOnLoad method. |
fikaradz |
fikaradz |
03/12/2022 |
jdaly |
reference |
Dynamics 365 (online) |
|
|
[!INCLUDE./includes/addOnLoad-description.md]
Read-only and editable grids
gridContext.addOnLoad(myFunction);
Name | Type | Required | Description |
---|---|---|---|
myFunction |
function reference | Yes | The function to be executed when the subgrid loads. The function will be added to the bottom of the event handler pipeline. The execution context is automatically passed as the first parameter to the function. See execution context for more information. |
To get the gridContext
, see Getting the grid context.
Add the myContactsGridOnloadFunction function to the Contacts subgrid OnLoad event.
function myFunction(executionContext) {
let formContext = executionContext.getFormContext(); // get the form context
let gridContext = formContext.getControl("Contacts");// get the grid context
let myContactsGridOnloadFunction = function () { console.log("Contacts Subgrid OnLoad event occurred") };
gridContext.addOnLoad(myContactsGridOnloadFunction);
}
[!INCLUDEfooter-include]