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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Page changing does not work when use Subgrid api 'setFilterXml'

(2) ShareShare
ReportReport
Posted on by 4
I use subgrid api 'setFilterXml' in form onLoad function , after subgrid data onload with the new filter xml, click the nextPage button, the nextPage button only just could change to '2', and then it will not work and do nothing when I click it again.
 
 
 
 
When it jump to page 2, and then I click next page again, it will not wok.
 
I have the same question (0)
  • Suggested answer
    Holly Huffman Profile Picture
    6,538 Super User 2025 Season 2 on at
     
    Good morning, afternoon, or evening depending on your location!
     
    It looks like the issue might be related to how setFilterXml is interacting with pagination in the Subgrid API. When you apply filtering dynamically in the onLoad function, it may refresh the subgrid in a way that disrupts the default paging functionality. Here’s what could be happening:
    Possible Causes:
    1. Filter Application Resets Paging Context
      • When setFilterXml is applied, it forces a refresh of the subgrid, which can reset the pagination state, preventing further navigation past page 2.
    2. Subgrid Not Properly Registering Next Page Requests
      • If filtering occurs too early (before the grid is fully loaded), the system might not correctly register page change requests beyond the first navigation.
    3. Pagination Behavior Conflicts with Data Refresh
      • After applying setFilterXml, the grid may need explicit handling to ensure pagination continues working after each page change.
    4. Potential API Limitation or Bug
      • Microsoft occasionally updates the behavior of Power Platform APIs. If this issue appeared after an update, it's worth checking if there’s a known bug or workaround in official documentation.
    Possible Fixes:
    Apply setFilterXml AFTER Subgrid Loads
    • Instead of setting the filter in onLoad, trigger it after the subgrid data loads using an event like OnDataRefresh.
    Manually Refresh the Grid After Paging
    • Use JavaScript to force a refresh each time the pagination button is clicked:
    function refreshSubgridAfterPaging(executionContext) {
        var formContext = executionContext.getFormContext();
        var subgridControl = formContext.getControl("your_subgrid_name");

    if (subgridControl) {
            subgridControl.refresh();
        }
    }

    Delay Filter Application Using Timeout
    • If the filter is applied too soon, delaying it may allow the subgrid to maintain correct paging behavior:
    setTimeout(function() {
        var subgridControl = formContext.getControl("your_subgrid_name");
        subgridControl.setFilterXml("<filter><condition attribute='statuscode' operator='eq' value='10000001' /></filter>");
        subgridControl.refresh();
    }, 1000);

    Test with Default Pagination First
    • Before applying the filter, confirm that paging works correctly without setFilterXml. This helps determine whether the issue is related to filtering or an underlying subgrid behavior.
    If none of these approaches resolve the issue, consider checking the browser console (F12 → Console) for any JavaScript errors that might indicate an API-related issue.

     
    Please note: I teamed up with CoPilot AI to research and craft the best response to your question!
    Hope this helps some!

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 > Customer experience | Sales, Customer Insights, CRM

#1
Pallavi Phade Profile Picture

Pallavi Phade 98

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 60 Super User 2025 Season 2

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans