dm-p / powerbi-visuals-html-content

Visualise column or measure values as HTML in your Power BI reports. Intended as a spiritual successor to the OG HTML Viewer custom visual, with some extra stuff thrown in.
MIT License
85 stars 18 forks source link

Iframe reload on click #79

Closed AranaNexplore closed 1 year ago

AranaNexplore commented 1 year ago

Describe the bug

The iframe reloads when click on other screen elements

To Reproduce

Create a iframe with what ever content, add a visual, for example stacked bar chart with content. Click on a column iframe container reloads so the page you navigated is lost

Expected behavior

HTML with an iframe should keep the content with out refreshing.

Screenshots/Workbook

powerBI__3

Power BI Setup (please complete the following information):

dm-p commented 1 year ago

Hi and thanks for raising.

Unfortunately, this is by design. All custom visuals are already an iframe inside a higher-order container. Power BI will re-draw the higher-order container each time an update happens on the canvas, even if interactions are disabled for a particular visual.

Any content that is passed into the visual itself will get re-rendered, because Power BI has redefined the custom visual's DOM and we have to re-apply the content for it to display for the user. With iframes, this means that the specified URL will re-initialise.

I've done some tests and even if we execute no further code on an update after initialising the iframe, Power BI will just return a blank space for the visual, so there's no way to circumvent it.

Here's a short video demonstrating what happens if we exit the HTML Content visua logic before anything else happens, which may hopefully clarify things further:

https://user-images.githubusercontent.com/10572054/217940952-9b892968-3fab-405e-9269-6faa192bdd72.mp4

AranaNexplore commented 1 year ago

Thanks for replying so fast. Then I'll search for another workaround on my project.