Quantcast
Channel: CRM Development 論壇
Viewing all articles
Browse latest Browse all 10280

Refresh All Sub Grids Using JavaScript

$
0
0

Hi.

I'm organizing forms, views and fields in MS CRM 2011 (UR5, Windows Server 2008 R2) for a Marina Company. And have a question about it.

There are 5 tabs and total 11 subGrids in an entity form and what I need is to refresh all subGrids when tab is clicked.

Most of the approaches guide me to use the code below;

var element = document.getElementById("subGridName");
element.refresh();

But I think, this is not effective. That's why, I prefer this;

function refreshAllSubgrids() {
    var allControls = Xrm.Page.getControl();
    if(allControls[0] == null){
        setTimeout('refreshAllSubgrids()',2000);
        return;
    }
    for(var i in allControls) {   
        if(allControls[i].getControlType()=="subgrid") {
            allControls[i].refresh();   
        }
    }
}

Here is the situation;

When I use the second JS code as an event for Contact entity I get no error and lo but same function throws exception both for Account and BoatCard entities. According to my thought, this is sth with the UR5 thing. 

I wonder if you prefer any solution or have thought about this.

Thanks in advance.

Can



Viewing all articles
Browse latest Browse all 10280

Trending Articles