Sunday, June 12, 2011

Retrieve rows in crm2011 subgrid with JScript

When I saw account entity I saw a grid which show related contact of the account entity then I think of reading the contact grid in JavaScript. After some search on google I found thread on stackoverflow Which has same question as in my mind and there as solution to that question as well posted.

List 1

I have modified the code posted on that question and modified code is listed in the List 1. Here you can see that element is search by id and I have provided name of the grid which is accountContactsGrid grid. The getRecordsFromInnerGrid function of the gridControl return the number of rows in the grid. The reason of getting the each row fourth column is shown below in the Image 1 as you can see that the fourth column has the detail of the cell in the row.

Image 1

In the inner loop I loop through each cell of the row and display outerText, the first two cell has empty string in the outerText as one is the checkBox cell and second one is the image cell. The name of the grid which I am using is taken from the dialog which is shown below in Image 2.


Image 2

All and any comments / bugs / suggestions are welcomed !

2 comments:

Anonymous said...

is there any way i can change the colour of a subdrid row in js ?

Ben L said...

This is great. It is almost everything I need. I am trying to see which rows are selected. It seems to always come up blank though. I am assuming the checkbox is the first Alert of each line?