Search code examples
javascriptpagingcrmrecordssubgrid

Reading all records of a subgrid regardless of the active page with JavaScript in Dnamics CRM 2011


I've got a JavaScript code that should iterate over all rows of a subgrid.

for (var intRowNumber = 0; intRowNumber < gridControl.getRecordsFromInnerGrid().length; intRowNumber++) 
{
    // do stuff
}

My problem is that this code iterates over only the items in the current subgrid page. For example, my grid can carry 4 records in one page. If I have 5 records, resulting in a second page, I cannot read the 5th record this way when I'm on the first page. And similary, if I go to the second page, only the 5th record will be read, and the first 4 will be ignored.

Is there a way to solve this problem? I'll be very happy for any code snippets or being redirected to a documentation/tutorial.

Thanks in advance.


Solution

  • I dont think this will ever work. The JavaScript can only ever return whats on the page, Crm only loads the data that is required at the time.

    To get all the records that would be in the view I would suggest using a web service call to get all the data you need.

    You will probably find this a lot easier and more reliable than parsing the grid. I would suggest start here for that.