Initially pivotGrid internalGrid seems to be an empty. It gets filled only after the loaded Event executes. So, the CollapseAllGroup () code should be placed within the dispatcher event as shown below to make the pivot grid to load all the data collapsed.
Figure: Pivot Grid shows all data collapsed
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
or the page will be automatically redirected to sign-in page in 10 seconds.