With the release of CRM 2015 Update 1 we can write supported scripts to get information from the subgrids.
Before CRM Online 2015 Update 1 the only unique method for the subgrid control was refresh.
As an Xrm.Page.ui control, GridControl also has all the standard control methods: getControlType, Label methods, getParent,Visible methods, setFocus, and Notification methods as well as refresh
OnLoad event
Add event handlers to this event to run every time the subgrid refreshes. This includes when users sort the values by clicking the column headings. Use the GridControl.addOnLoad and GridControl.removeOnLoad methods to manage event handlers, usually in the form Onload event.
Example :
Xrm.Page.getControl("Contacts").addOnLoad(<functionname>);
getEntityName
Use this method to get the logical name of the entity data displayed in the grid.
getGrid
Use this method to get access to the Grid available in the GridControl.
getViewSelector
Returns the ViewSelector objects available in GridControl.
removeOnLoad event
Removes event handler from the GridControl onLoad event.
Grid
getRows
Returns a collection of every GridRow in the Grid
var allRows = Xrm.Page.getControl("Contacts").getGrid().getRows();
getSelectedRows
Returns a collection of every selected GridRow in the Grid
var selectedRows = Xrm.Page.getControl("Contacts").getGrid().getSelectedRows();
getTotalRecordCount
Returns the total number of records in the Grid
var filteredRecordCount = Xrm.Page.getControl("Contacts").getGrid().getTotalRecordCount();
GridRow
getData
Returns the GridRowData for the GridRow.
GridRowData
getEntity
Returns the GridEntity for the GridRowData.
GridEntity
getEntityName
Returns the logical name for the record in the row.
var firstEntityType = Xrm.Page.getControl("Contacts").getGrid().getRows().get(0).getData().getEntity().getEntityName();
getEntityReference
Returns a lookup object for the record in the row.
var firstEntityReference = Xrm.Page.getControl("Contacts").getGrid().getRows().get(0).getData().getEntity().getEntityReference();
getId
Returns the id for the record in the row
var firstEntityId = Xrm.Page.getControl("Contacts").getGrid().getRows().get(0).getData().getEntity().getId();
getPrimaryAttributeValue
Returns the primary attribute value for the record.
var firstEntityPrimaryAttributeValue = Xrm.Page.getControl("Contacts").getGrid().getRows().get(0).getData().getEntity().getPrimaryAttributeValue();
ViewSelector
getCurrentView
Returns a reference to the current view.
var currentView = Xrm.Page.getControl("Contacts").getViewSelector().getCurrentView();
isVisible
Returns true if view selector is visible, false if not.
var viewSelectorIsVisible = Xrm.Page.getControl("Contacts").getViewSelector().isVisible();
setCurrentView
Sets the current view
var ContactsIFollow = { entityType: 1039, // SavedQuery id:"{3A282DA1-5D90-E011-95AE-00155D9CFA02}", name: "Contacts I Follow" } //Set the view using ContactsIFollow Xrm.Page.getControl("Contacts").getViewSelector().setCurrentView(ContactsIFollow);
References:
https://msdn.microsoft.com/en-us/library/dn932137.aspx
CRM 2015 Client API Reference
https://drive.google.com/file/d/0B9-OddqJEKamWEs0MV9MMDdsWE0/view?pli=1
thanks for reading my post :)

*This post is locked for comments