web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Refresh an Editable Sub Grid with JavaScript

(0) ShareShare
ReportReport
Posted on by

I have tried the following:

  • document.all['GridName'].control.refresh();
  • document.getElementById("GridName").control.fireControlEvent("OnRefresh", Sys.EventArgs.Empty);
  • window.parent.opener.document.getElementById("GridName").control.refresh();
  • var subgrid = Xrm.Page.ui.controls.get("GridName");
    subgrid.refresh();

All to no avail and keep getting: TypeError: Cannot read property 'refresh' of null at refreshSubGrid  

Any help most welcome

EstimationLines

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    I just keep getting the error: Cannot read property 'refresh' of null at refreshSubGrid

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Greame,

    Which version are you in? I tried it on 8.2 and it is working as expected.

    I tried on the out of box Account entity for the Contacts subgrid. Here is the sample script

    ========

    function refreshContactGrid()

    {

    var subgrid = Xrm.Page.ui.controls.get("Contacts");

    subgrid.refresh();

    }

    =============

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    The error "Cannot read property 'refresh' of null at refreshSubGrid" sim,ply means that the the script is unable to find the subgrid.

    Ensure youi are using the correct name

    Hope this helps.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Graeme,

    Seems the control not loaded properly and it's getting null. So you can try to add setTimeout or set interval and offcourse null check of grid control before doing grid refresh.

    Hope this helps.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi,

    Can you validate the name of the grid is correct in your code, and that you are getting a return value for the following:

    var gridName = "new_subgridname";

    var subgrid = Xrm.Page.ui.controls.get(gridName);

    subgrid.refresh();

    Hope this helps.

  • Community Member Profile Picture
    on at

    Thanks Goutam, adding in a Timeout fixed the issue.

  • Emre GULCAN Profile Picture
    2,379 on at

    Hi,

    Maybe you can use "data.refresh", it works with normal grids but don't test with editable grids.

    of course should not forget that this method refresh all form data

    msdn.microsoft.com/.../dn481607.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans