Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Client API grid context helps you access and work with tabular data in grids and subgrids on a form. Grids can span the entire form or appear as form items called subgrids.
The Client API grid context provides reference to a subgrid on a form against which the current code is executed.
Use the formContext to get an instance of the form where the code is executed, and then retrieve the subgrid control on the form. For example, when you know the name of a subgrid control (say Contacts subgrid in the default account form), you can access it using the following code:
function doSomething(executionContext) {
var formContext = executionContext.getFormContext(); // get the form Context
var gridContext = formContext.getControl("Contacts"); // get the grid context
// Perform operations on the subgrid
}
Limitations
- Getting the context of a grid (spanning the entire form) is only supported in ribbon commands. For more information, see Form and grid context in ribbon actions.
- Calls to
getControl()aren't supported when you usegridContext. - Grid contexts have the same validity as their execution context. Once the event handler for the execution context finishes, these contexts require extra care to use. See Using context objects asynchronously.
Related articles
Client API form context
Client API execution context
Understand the Client API object model
Grids and subgrids