<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Power BI Custom Visual - An event that trigger when user shift between pages of the same report. in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4266833#M11712</link>
    <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developing a powerbi custom visual.&lt;/P&gt;&lt;P&gt;There I need to write some logic when the user shifted from the current page that the custom visual resides, to another page of the same report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently used the&amp;nbsp;"window.onbeforeunload" event. It trigger when user close the browser or close the browser tab.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But not trigger when shift to another page of the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice me if any of you got to know a way of trigerring an event when shifting to another page.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Lasanths&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 11:30:21 GMT</pubDate>
    <dc:creator>dakdgdl</dc:creator>
    <dc:date>2024-11-01T11:30:21Z</dc:date>
    <item>
      <title>Power BI Custom Visual - An event that trigger when user shift between pages of the same report.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4266831#M11710</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developing a powerbi custom visual.&lt;/P&gt;&lt;P&gt;There I need to write some logic when the user shifted from the current page that the custom visual resides, to another page of the same report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently used the&amp;nbsp;&lt;SPAN&gt;"window.onbeforeunload" event. It trigger when user close the browser or close the browser tab.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But not trigger when shift to another page of the report.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please advice me if any of you got to know a way of trigerring an event when shifting to another page.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Lasanths&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 11:26:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4266831#M11710</guid>
      <dc:creator>dakdgdl</dc:creator>
      <dc:date>2024-11-01T11:26:04Z</dc:date>
    </item>
    <item>
      <title>Power BI Custom Visual - An event that trigger when user shift between pages of the same report.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4266833#M11712</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm developing a powerbi custom visual.&lt;/P&gt;&lt;P&gt;There I need to write some logic when the user shifted from the current page that the custom visual resides, to another page of the same report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently used the&amp;nbsp;"window.onbeforeunload" event. It trigger when user close the browser or close the browser tab.&amp;nbsp;&lt;/P&gt;&lt;P&gt;But not trigger when shift to another page of the report.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advice me if any of you got to know a way of trigerring an event when shifting to another page.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Lasanths&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 11:30:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4266833#M11712</guid>
      <dc:creator>dakdgdl</dc:creator>
      <dc:date>2024-11-01T11:30:21Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Custom Visual - An event that trigger when user shift between pages of the same report.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4268188#M11721</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/438849"&gt;@dakdgdl&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/f8aea10abaa3d9120a98befd4d22b66025876c7b/src/visuals-api.d.ts#L1798-L1799" target="_self"&gt;An &lt;FONT face="courier new,courier"&gt;IVisual&lt;/FONT&gt; has an optional&amp;nbsp;&lt;FONT face="courier new,courier"&gt;destroy()&lt;/FONT&gt; event&lt;/A&gt; called by the visual host (if it exists) when your visual is preparing to be unloaded, to which you can add logic. Have you seen if this fits your requirements?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A visual doesn't know about the report, only itself, so there are no APIs for notification of page change events. A visual&amp;nbsp; instance is destroyed when this happens, and if you have another instance of your visual on the other page, this will trigger a new instance and &lt;FONT face="courier new,courier"&gt;constructor()&lt;/FONT&gt; call for that instance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Sun, 03 Nov 2024 20:42:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4268188#M11721</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2024-11-03T20:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI Custom Visual - An event that trigger when user shift between pages of the same report.</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4268561#M11722</link>
      <description>&lt;P&gt;Hi dm-p&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for responding..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes I tried the "destroy()" method of IVisual.&lt;/P&gt;&lt;P&gt;But the problem is it doesn't get triggered when user shift to another page, because, visual instance of the page doesn't get destroyed when shift to another page. It remains and only thing happen is , it's update method trigger again, when come back to that page from the other page. "destroy" method trigger only when programmatically or some way remove the visual elemnt from the page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other reason that "destroy" method is not suitable for my requirement is, it doesn't have a method parameter like the "window.on&lt;SPAN&gt;beforeunload" has the parameter "&lt;/SPAN&gt;&lt;SPAN&gt;event&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;returnValue", that should set a value, when need to hold the tab or browser closing.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Lasantha&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 05:17:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Power-BI-Custom-Visual-An-event-that-trigger-when-user-shift/m-p/4268561#M11722</guid>
      <dc:creator>dakdgdl</dc:creator>
      <dc:date>2024-11-04T05:17:59Z</dc:date>
    </item>
  </channel>
</rss>

