I created sample PCF control for dataset.As I already know that update method call when we click on show chart or click on refresh button from ribbon bar.I want a ways from which it easy to identify update method call because of show chart .
So is there any way to identify that.
No information is sent alongside the trigger so you won't know what triggered it (updateview is called whenever anything changes so it's could just as easily be because the browser window has changed size)
I suspect if the user has clicked a graph and changes the view the dataset available to the PCF component will be changed / refreshed (I don't have time to test that process). If that's the case you could keep a track within the PCF of the record count of the initial dataset and the count of the new dataset and a change in record count as your identifier.
@ben-thompson is correct. When you click on a chart segment/refresh button/quick find/view selector, the data is simply reloaded and piped to the updateView - you don't get notified of why it has changed - only that it has changed.
I do a record count and row by row comparison on the sortedRecordIds to establish if any of the data has been changed.
Hope this helps
Maybe you can make use of context.updatedProperties that are passed with the updateView method.
This is documented in the sdk, but is not really documented what can be the content of this Array of strings.
I've made a short check, and saw that:
- after change the view selector you get : ["layout"]
- after change the filter: ["dataSetGrid", "parameters"] or ["dataSetGrid", "parameters", "dataset"]
- after refresh button: ["dataSetGrid", "parameters"]
- after open a chart: ["layout", "dataSetGrid", "parameters", "dataset"]
Also there are a lot calls with empty array passed in between.
I think is not very safe to rely on this, is depends what you need to do, but maybe it helps.
If it's documented in the SDK then it's the go to solution and I suspect the documentation is lacking because it may not be populated in all circumstances.
I suspect a combination of this and checks against the old and new datasets would be the ideal approach.
Watch Microsoft Business Applications Summit sessions on-demand.
And the winner is...
The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!
Features releasing from April 2020 through September 2020