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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Sub grid On change event
Power Pages
Unanswered

Sub grid On change event

(1) ShareShare
ReportReport
Posted on by 2

Hi, I want to run a function on change of sub grid in power pages basic form, that is on adding related record I want to lock a field. Any suggestion how I can find on change event of that sub grid using JavaScript?

Categories:
I have the same question (0)
  • Fubar Profile Picture
    8,354 Super User 2025 Season 2 on at

    The Lists and Subgrids support a "loaded" event

    https://learn.microsoft.com/en-us/power-pages/configure/add-custom-javascript-list

     

    In cases where the 'loaded' event does not suffice then the other way is to implement a javascript MutationObsever

     

  • Furban Profile Picture
    9 on at

    I came across the same issue. I managed to run a function on the List. However, I cannot find a way of how to run a function on the sub grid.


    Have you found a work around?

  • Fubar Profile Picture
    8,354 Super User 2025 Season 2 on at

    @Furban the "loaded" event works on subgrids also, but the object that you attach it to is probably not entity list, just inspect the rendered page with your browsers debugger to find the subgrid object (and be careful if you have multiple subgrids, you will want to only apply it to the one you are interested in). 

    Also, a MutationObserver can be used.

  • Furban Profile Picture
    9 on at

    Thank you for introducing me to the MutationObserver, but my issue still persists.

     

    I managed to find the object, but when I insert the JS function 'onload' in the Basic Form, it is still not being called because the page loads before the subgrid within the same Basic Form. So far, I have only managed to implement the change by using a timeout. However, this solution is a bit crude, as it will display the dropdown for a split second instead of the button.

  • Fubar Profile Picture
    8,354 Super User 2025 Season 2 on at

    @Furban as per the example code in the link you need to put it inside a JQuery document ready (or similar).  It won't work with a standard onload as the DOM is not fully populated when onload is triggered, after the document ready triggers the subgrid container will exist in the DOM (it will then start to load its contents, when its contents are loaded you use the loaded event, a mutation observer can be used in a similar way but can also pickup as the contents are loading e.g. each row is being populated vs after they have loaded).

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Fubar Profile Picture

Fubar 78 Super User 2025 Season 2

#2
Jerry-IN Profile Picture

Jerry-IN 75

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard