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

Announcements

News and Announcements icon
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,487 Super User 2026 Season 1 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,487 Super User 2026 Season 1 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,487 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
rezarizvii Profile Picture

rezarizvii 71

#2
DP_Prabh Profile Picture

DP_Prabh 36

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 32 Most Valuable Professional

Last 30 days Overall leaderboard