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 Apps / On update of view filt...
Power Apps
Unanswered

On update of view filter, PCF control data-set doesn't return any records

(0) ShareShare
ReportReport
Posted on by 2

Hello

I have an issue on my PCF control that is attached to a view.
I have a data-set called 'gridDataSet'. When the 'updateView' method initially loads, the 'context.parameters.gridDataSet.sortedRecordIds' array contains multiple guids and this is the correct result. 

Once I search for a value or add a filter, the 'context.parameters.gridDataSet.sortedRecordIds' array always returns 0 guids. Even If I then clear my search value and remove all filters, the 'context.parameters.gridDataSet.sortedRecordIds' array again returns 0 guids even though 1000s of record Guids should be returned. The 'context.parameters.gridDataSet.paging.hasNextPage' returns false and the 'context.parameters.gridDataSet.paging.totalResultCount' contains a number > 0 if the results are less than the page size.

Other views on the same table work correctly and return results, it's just my PCF Controls view that returns 0 values when it's modified. If I remove the PCF control and then modify the filter, values are returned. My PCF control was working until I published all customisations so I'm not sure if something outside the PCF control is configured incorrectly or not.

Update View method

updateView = function (context) {
    var _this = this;

    if (!context.parameters.gridDataSet.loading) {
         if (context.parameters.gridDataSet.paging != null && context.parameters.gridDataSet.paging.hasNextPage == true) {
              context.parameters.gridDataSet.paging.setPageSize(5000); 

              context.parameters.gridDataSet.paging.loadNextPage();
      }

      else {
           //Results on initial Load before I change the filter
          //context.parameters.gridDataSet.sortedRecordIds contains 17800 guids
          //context.parameters.gridDataSet.records is a populated object

          //Results on after filter is changed or I search a value that should have > 0 results
          //context.parameters.gridDataSet.sortedRecordIds contains 0 guids
         //context.parameters.gridDataSet.records is a null object {}

      }
    }
}

Thanks in advance,
Demi

I have the same question (0)
  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @dbrauer , 

     

    Did you had a look in the network protocol? After you set the filter, you schould see there the corresponding fetch and the result. Are there any records?

     

    Another thought: how do you set the filter? Do you set the dataset on page 1, before you refresh the data?

     

     

  • dbrauer Profile Picture
    2 on at

    Hi Diana

    Thank you for the quick response.

     

    No I haven't, can you please provide some detail on how to to do so? After I set the filter, I tested the exported fetchxml and it returned 1000s of records. I can add any filter and sortedRecordIds always has 0 guids

    The view itself does not have any filters configured and I have not applied any filter to the PCF control code.
    When I filter the data, I am only filtering the data through the UI using the view search and the filter (as highlighted in the screenshot below)

    dbrauer_2-1665618126935.png


    I don't currently set the dataset pageNumber and when the data refreshes after I apply the filter, the pageNumber is already set to 1. Screenshot below is what the data-set paging looks like after the filter is applied and finished loading:

    dbrauer_1-1665616625401.png

    I tried setting the pageNumber to 1 after the inital load and then adding a filter but the sortedRecordIds still returns 0 guids. I've also tried running 'context.parameters.gridDataSet.refresh()' but this also didn't work

    Thanks,
    Demi

     

  • Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @dbrauer , 

     

    How about making this test:

    - change the line of code for setting the pageSize on 5000 inside your init method. Call dataset.refresh() directly after that. We'll test with 5000 rows for now, and care later about paging

    //the init function
    context.parameters.gridDataSet.paging.setPageSize(5000); 
    context.parameters.gridDataSet.refresh()
    

    - inside updateView let's remove the part where you check about loading state, and only log the number of records. The updateView will be called a few times (sometimes there are no records inside your dataset, but the last call will have the data)

    updateView = function (context) {
     console.log(context.parameters.gridDataSet.sortedRecordIds.length);
    }

     
    Let's see we can move further in detecting the issue.

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 Apps

#1
11manish Profile Picture

11manish 510

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 281

Last 30 days Overall leaderboard