<?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 Re: 🔄 Selection Reset When Clicking DataGrid After Filtering in Power BI Custom Visual in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4408622#M59477</link>
    <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930073" data-lia-user-login="chcacco" class="lia-mention lia-mention-user"&gt;chcacco&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to custom visual save states, you might consider checking out the following links:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-BI-Custom-Visual-state-persistence/m-p/1661876" target="_blank"&gt;Solved: Re: Power BI Custom Visual state persistence - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/69867050/powerbi-desktop-custom-visual-storage-problem" target="_blank"&gt;PowerBI Desktop Custom Visual - Storage Problem - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Webinars-and-Video-Gallery/Trick-to-persist-properties-of-Power-BI-visuals-after-refresh/m-p/196746" target="_blank"&gt;Trick to persist properties of Power BI visuals af... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Make sure you are using the latest version of the software. Sometimes updates contain fixes for such issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2025 08:13:28 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-02-13T08:13:28Z</dc:date>
    <item>
      <title>🔄 Selection Reset When Clicking DataGrid After Filtering in Power BI Custom Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4406939#M59459</link>
      <description>&lt;P&gt;Im developing a Power BI Custom Visual using &lt;STRONG&gt;React&lt;/STRONG&gt; + &lt;STRONG&gt;TypeScript&lt;/STRONG&gt; + &lt;STRONG&gt;MUI DataGrid&lt;/STRONG&gt;. The visual correctly applies filtering when selecting a slice in a Pie Chart. However, when I click on a cell in the &lt;STRONG&gt;DataGrid&lt;/STRONG&gt; after filtering, Power BI triggers &lt;STRONG&gt;update()&lt;/STRONG&gt; and resets the selection, forcing all rows to regenerate.&lt;BR /&gt;&lt;BR /&gt;Can someone point me in the right direction in order to solve this issue?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Feb 2025 11:50:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4406939#M59459</guid>
      <dc:creator>chcacco</dc:creator>
      <dc:date>2025-02-12T11:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: 🔄 Selection Reset When Clicking DataGrid After Filtering in Power BI Custom Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4408622#M59477</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930073" data-lia-user-login="chcacco" class="lia-mention lia-mention-user"&gt;chcacco&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to custom visual save states, you might consider checking out the following links:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Developer/Power-BI-Custom-Visual-state-persistence/m-p/1661876" target="_blank"&gt;Solved: Re: Power BI Custom Visual state persistence - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/69867050/powerbi-desktop-custom-visual-storage-problem" target="_blank"&gt;PowerBI Desktop Custom Visual - Storage Problem - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Webinars-and-Video-Gallery/Trick-to-persist-properties-of-Power-BI-visuals-after-refresh/m-p/196746" target="_blank"&gt;Trick to persist properties of Power BI visuals af... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Make sure you are using the latest version of the software. Sometimes updates contain fixes for such issues.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 08:13:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4408622#M59477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-02-13T08:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: 🔄 Selection Reset When Clicking DataGrid After Filtering in Power BI Custom Visual</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4409103#M59485</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="930073" data-lia-user-login="chcacco" class="lia-mention lia-mention-user"&gt;chcacco&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-pm-slice="0 0 []"&gt;The issue occurs because Power BI's update() method triggers a full refresh of the custom visual whenever an interaction happens, such as clicking on a cell in the MUI DataGrid. This causes the selection state to reset, leading to all rows regenerating instead of preserving the previous selection. To resolve this, you need to maintain state persistence within React, ensuring that selected rows remain unchanged even when Power BI updates the visual. One way to do this is by using React state hooks (useState) or refs (useRef) to store the selected row IDs before the update occurs. Additionally, using suppressAnimations: true in Power BI's visual API can prevent unnecessary UI resets. Another key approach is to restore the selection state inside update() by reapplying previously stored selections after the visual updates. Furthermore, optimizing the filtering logic ensures that only affected rows change rather than reloading all rows. If needed, integrating Power BI's selectionManager can provide better control over interactions and prevent unwanted state loss when clicking on DataGrid elements.&lt;/P&gt;
&lt;P data-pm-slice="0 0 []"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2025 13:01:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Selection-Reset-When-Clicking-DataGrid-After-Filtering-in-Power/m-p/4409103#M59485</guid>
      <dc:creator>Poojara_D12</dc:creator>
      <dc:date>2025-02-13T13:01:08Z</dc:date>
    </item>
  </channel>
</rss>

