cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Paging and Filtering - dataset

Hi everyone - hoping I can get some help with a paging/filtering issue I have. Basically I'm trying to create a dataset control that loads the next page as you scroll, but it's not working when I change the filter - for instance I expected 18 records returned, but it's not returning any (see image below for dataset output).

skoofy5_0-1605229687860.png

 

Essentially I've got an event that fires when you scroll and it hits the last record it will then fire loadNextPage(). This works fine when I load it up and when I search the control it's only when changing the filter that the dataset consistently returns no records.

 

If I load up all the records in the updateView method at the start then the filtered view loads fine.

 

if (context.parameters.DataSet.paging.hasNextPage) {
   context.parameters.DataSet.paging.loadNextPage();

return;
}

6 REPLIES 6
Super User
Super User

Hi @skoofy5 , 

 

Not very sure if I get it right, since I'm not sure how you search and how you filter.

In my PCFs I've used loadExactPage instead of loadNextPage, so it might be different, but I had a similar issue there: when the user was searching, I had to move back to the first page, otherwise I didn't get the data.

In my case I've used dataset.paging.loadExactPage(1), but in your case the 

dataset.paging.reset()

could work too (since it resets to page 1). After that I had to call the data dataset.refresh() too.

Hope this helps!

 

Kind regards,

Diana

 

PS: Just in case you wonder, I know loadExactPage is not documented, so basically unsupported, but as @ScottDurow showed in his blog https://develop1.net/public/post/2020/05/07/pcf-dataset-paging-in-mode-vs-canvas-apps, there aren't much options for implementing for both model-driven and canvas apps. 

 

Thanks, Diana. I have seen some info from Scott earlier about loading an exact page, but I was pretty happy to have the cumulative dataset that got returned with loadNextPage. I've tried your other suggestions with no success, unfortunately, so I'll try loadExactPage next.

The repro steps are:

  1. Load initial dataset with multiple pages.
  2. Hit loadNextPage at least once and have additional pages to load.
  3. Filter the dataset (with records expected to be returned of course) and no records will exist in the returned dataset, but the total result count will be the total expected to be returned (as my image shows in the first post).

skoofy5_1-1605490766613.png

If you then clear and apply the filter again the records are returned in the dataset as expected.

This issue does not occur if you follow the repro steps above, but then before you filter you search or if the page size is large enough and loads all the records. It also does no occur subsequently if you swap between views with the same control applied.

Hi @skoofy5 , 

 

I can confirm that following your repro steps, I get the same error.

So it's not because of loadNextPage or loadExactPage. Actually has nothing to do with our code. 

 

It happens only when you use the "Advanced Filtering panel", like in your screenshot above, but doesn't happend when you just type something in the search box.

Actually is not happening only with 3rd party PCFs, but also with the out of the box grids. You can use the ribbon "Show As" -> "Read only grid", and test the standard. It's exactly the same behavior.

 

I've checked what fetchXML is send in the background by the platform.

If I use the search box (which works), I see the following fetchXML in the network protocol:

<fetch version="1.0" mapping="logical" returntotalrecordcount="true" page="1" count="25" no-lock="false">
<entity name="orb_pcftester">
   <attribute name="orb_ampel"/><attribute name="orb_prio"/><attribute name="orb_optionsetcode"/><attribute name="statecode"/><attribute name="orb_pcftesterid"/> 
   <attribute name="orb_name"/><attribute name="createdon"/>
   <order attribute="orb_name" descending="false"/>
   <filter type="and">
      <condition attribute="statecode" operator="eq" value="0"/>
   </filter>
   <filter type="or" isquickfindfields="1">
      <condition attribute="orb_name" operator="like" value="impo%"/>
   </filter>
</entity>
</fetch>

If I use the "Advanced Filtering Panel", I see the similar fetch, but page "2", and that's the reason for not finding records:

<fetch version="1.0" mapping="logical" returntotalrecordcount="true" page="2" count="25" no-lock="false">
<entity name="orb_pcftester">
<attribute name="statecode"/><attribute name="orb_name"/>
<order attribute="orb_name" descending="false"/>
<attribute name="modifiedon"/><attribute name="orb_optionsetcode"/><attribute name="orb_prio"/><attribute name="orb_ampel"/><attribute name="orb_pcftesterid"/>
   <filter type="and">
      <condition attribute="statecode" operator="eq" value="0"/>
      <condition attribute="orb_name" operator="like" value="Impo%"/>
   </filter>
</entity></fetch>

 

I hope the product team can help us. 

Maybe you can open a support ticket, since the bug can be reproduced with out of the box grids.

 

Kind regards,

Diana

Hello @HemantG ,

 

It seems that there is a bug with "Advanced Filtering Panel" search, which doesn't reset the page when the filter is changed. The last 2 messages in this thread are showing the repro and the paging issues. It happens to standard grids too.

Is the product team already aware of this? I'm not sure if it's a PCF or a Dynamics bug. Maybe we should report it somewhere else?

 

Kind regards,

Diana

Power Apps
Power Apps

Ack, we will review and update the thead. It seems this is a bug,

 

hemant 

Any updates? I've posted another issue in regards to linking/adding columns that seems to create a similar issue when filtering.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Users online (33,618)