When we need to extend the Grids trough Javascripts, we should use the client sdk to avoid problems in the future, not only because of upgrades, but as well update rollups.
Reading an article from MSDN, found written that only the refresh method was available, what means other extensions were not "supported".
This few examples are can applied to a CRM 2015 Online Organization with Update 1. Hope that it can be available as well for OnPrem near in the future.
1. Getting the Grid Control, and it was already working previously:
var contactsSubgrid = Xrm.Page.getControl("Contacts");
2. Add an event on load:
var myContactsGridOnloadFunction = function () { console.log( "Contacts Subgrid OnLoad occurred" ) }; Xrm.Page.getControl( "Contacts" ).addOnLoad(myContactsGridOnloadFunction);
3. Get all rows:
var allRows = Xrm.Page.getControl( "Contacts" ).getGrid().getRows();
Source of the code:
I will do more examples with this, and write a new version of tested methods and results.
Hope it can help.
Comments