Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
Unanswered

Custom control: setFilter() and refresh() do not work when first result has only a single page.

Posted on by 5

Hi,

I am creating a PCF control that can be used to visualize a list of activities. It's important this control visualizes quickly, so as an optimization I want to add a filter on the dataset which only retrieves recent records. When this dataset is loaded and the user can click, I remove the filter and all records are loaded in the background, allowing the user to start working (assuming the already loaded records are what the user wants to view).

Basically, the control works as follows:

- init, setFilter with date > 14 ago and date < next 14 days,

- updateView, first page of results, updates the visible data 

- updateView, next page (if applicable) 

    ...

- In the last updateView when all pages are loaded, the filter is removed, and the dataset is refreshed using context.parameters.dataSet.refresh().

- updateView, first page of results, updates all data (since no filtering is applied).

- updateView, next page (if applicable)

    ... etc.

This works like a charm if the initial result has multiple pages. 

However, when I try to refresh a dataset which has only one page, the new filter (which should return all records) is never applied and exactly the same records are returned after the refresh().

Am I doing something wrong? I tried clearing the filter before setting it, resetting the paging, changing the page size, but nothing seems to trigger an update for the record set if the initial one is only one page.

Kind regards, 

Maarten van Sambeek

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Custom control: setFilter() and refresh() do not work when first result has only a single page.

    Bringing this post back from the dead. I am also getting this issue as well. I am doing some advanced filtering and sorting on my fetchxml for the dataset view. When it first loads the data on my pcf the filter works like a charm. But if I hit refresh then the filter removes itself, until I reload the whole page again.

    Anyone else have a solution to this?

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,564 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,651 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans