Update Rollup 0.1 – Enhanced Subgrid Capabilities

For me, one of the most promising features in UR 0.1 was the Enhanced Subgrid Capabilities. After reading the SDK articles and playing with it, my excitement somewhat subsided, yet I believe it is a step in right direction and hope for additional key features in future versions.

According to the SDK (v7.1.0) the Enhanced Subgrid Capabilities are available only for Microsoft Dynamics CRM Online with RU 0.1 applied. It is unclear if and when these features will be available for on-premise deployments.

Before describing the full half of the glass, here is what I am missing:

  1. All Grid types support, not just Subgrid: I would like to have a similar API for any type of grid control, such as associated view grid and entity level grid
  2. Grid Row selection event: An event raised when a grid row is selected would improve code elegancy and performance as it will prevent the need for some ugly ass polling code to determine if and which row was selected
  3. Access Grid row data: a supported method to access all row data, not just entity name, record id and primary attribute. This will prevent a server query to retrieve data which has already been sent to the client side
  4. Set Custom View: allowing developers to set the Grid view dynamically with a function similar to addCustomView (which exists for Lookup controls) will prevent usage of the common unsupported method used to achieve this required capability

What features did we get? following is a brief description of the objects, events and methods of this new API along with my notes:

  1. GridControl object
    1. onLoad event – according to the SDK, this event fires whenever the subgrid is refreshed. Actually, this event is not raised when the containing form is loaded or when the grid’s view is manually/programmatically changed, which in my opinion counts as a refresh.
      This event also fires when adding grid records, deleting grid records, on programmatic grid refresh and column sorting event.
      When deleting a grid record, the event fires twice – before and after the delete dialog.
    2. addOnLoad – adds an event handler to the subgrid onLoad event
    3. removeOnLoad – removes an event handler from the subgrid onLoad event
    4. getGrid – get reference to the Grid object via the GridControl object
    5. getViewSelector – get reference to the ViewSelector object via the GridControl object
    6. getEntityName – get the logical name of the entity which data is displayed in the grid
  2. Grid object
    1. getRows – returns a collection of GridRow objects, limited to the Grid rows in the currently displayed page
    2. getSelectedRows – returns a collection of selected GridRow objects for every selected Grid row in the currently displayed page.
      Since form subgrid does not allow multiple record selection, this function always returns one GridRow object
    3. getTotalRecordsCount – returns the total number of records that match the filter criteria of the applied view
  3. GridRow object
    1. getData – returns a GridRowData object for the selected GridRow
  4. GridRowData object
    1. getEntity – returns a GridEntity for the GridRowData object
  5. GridEntity object
    1. getEntityName – returns the logical name for the record in the specified row.
      This can be useful for mixed entity grids such as Activities grid
    2. getEntityReference – returns a Lookup object representing the record in the specified row
    3. getId – returns the GUID for the record in the specified row
    4. getPrimaryAttributeValue – returns the primary attribute value for the record in the specified row
  6. ViewSelector object

    1. getCurrentView – get a reference to the current applied view
    2. isVisible – determine whether the view selector control is visible
    3. setCurrentView – set the current view.
      This function has no effect if the View Selector object is invisible


This unmanaged solution contains code sample demonstrating the various objects, events and method usage via the Account form. As mentioned, this code will work only in Microsoft Dynamics CRM Online with RU 0.1 applied.
This solution adds a ‘DEMO SUBGRID’ button to the Account form, do not install this solution on your production environment.