Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
Question pls. I have used Basic Filter API to influence other off-the-shelf and custom visuals. But somehow the visual triggers and update as well.
host.applyJsonFilter(filter, "general", "filter", powerbi.FilterAction.merge);
Is this normal and if it's possible to stop the update on the visual which triggers the filter?
Thanks.
Solved! Go to Solution.
Hi @KennethWang,
Pretty much any interaction with your visual is going to trigger its update method, so there might be a way of checking what's actually happening and planning for it.
When the update method runs, the options object exposes a type property, which provides a VisualUpdateType enum. You can console.log() this to see what value is provided when your filter runs and see if this can be captured in a switch statement or similar. Here's an example in one of my visuals where we ensure that we don't always re-process the view model if there is no need to (e.g. for a resize event).
Another way might be to check and store the value of the options.jsonFilters property at the end of each update as a class property, so that you can compare it value from the last update to its value in the current one and handle your visual workflow accordingly.
Failing that, you may need specific help from the Custom Visuals team - they don't monitor the Developer forum, but regularly address unanswered topics in the Custom Visuals Development Discussion forum on this board. They can also be reached at pbicvsupport@microsoft.com.
I hope this helps, at least a little. Good luck!
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi @KennethWang,
Pretty much any interaction with your visual is going to trigger its update method, so there might be a way of checking what's actually happening and planning for it.
When the update method runs, the options object exposes a type property, which provides a VisualUpdateType enum. You can console.log() this to see what value is provided when your filter runs and see if this can be captured in a switch statement or similar. Here's an example in one of my visuals where we ensure that we don't always re-process the view model if there is no need to (e.g. for a resize event).
Another way might be to check and store the value of the options.jsonFilters property at the end of each update as a class property, so that you can compare it value from the last update to its value in the current one and handle your visual workflow accordingly.
Failing that, you may need specific help from the Custom Visuals team - they don't monitor the Developer forum, but regularly address unanswered topics in the Custom Visuals Development Discussion forum on this board. They can also be reached at pbicvsupport@microsoft.com.
I hope this helps, at least a little. Good luck!
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
12 | |
2 | |
2 | |
1 | |
1 |