Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
DanielSH
Frequent Visitor

Force redraw of formatting panel

Not sure if I'm missing something obvious or if I'm doing something I'm not supposed to...

In my custom visual I allow my users to upload some pictures in Advanced Edit mode, and later on I'd like to allow them to select these pictures in the formatting panel in a drop-down.

 

I'm able to implement all of this, the only problem is that I need to resize my visual to trigger a redraw of the formatting panel so the content of the drop-down is actually updated. I tried explicitly calling getFormattingModel(), but it makes no difference.

 

I put together a simplified project to demo this behavior.

 

Steps to reproduct the problem:

1. Start the visual, and navigate to the formatting panel: see that the "Default color" formatting slice is disabled

2. Click the "Populate dropdown values" button on the visual itself: see that the array that previously showed empty is now showing some values on the visual. The "Default colors" formatting slice is still disabled

3. Resize the visual: this will trigger a re-initialization of the formatting settings, and now "Default color" becomes enabled, and the drop-down has the same values as the array.

Source code is here: https://github.com/DanielSzentimrey-Harrach/formatPaneUpdateExample/tree/master

 

Again, my question is how to trigger the formatting panel redraw programmatically, without the need to resize my visual.

I looked at this page in the documentation, but still couldn't figure out how to do it.

https://learn.microsoft.com/en-us/power-bi/developer/visuals/power-bi-visuals-concept

 

Any help would be much appreciated,

Daniel

1 ACCEPTED SOLUTION
DanielSH
Frequent Visitor

Answering my own question: after some more digging around I found that the IVisualHost interface contains a function called refreshHostData(); Calling this function programmatically will lead to a redraw of the formatting panel without the need to resize the visual.

View solution in original post

2 REPLIES 2
Covid19
Frequent Visitor

Excellent! I have been looking for a way to dynamically update data in the drop-down list of the formatting panel for a long time. Thank you.

DanielSH
Frequent Visitor

Answering my own question: after some more digging around I found that the IVisualHost interface contains a function called refreshHostData(); Calling this function programmatically will lead to a redraw of the formatting panel without the need to resize the visual.

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors