<?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 Overwrite default value from property panel in Custom Visuals Development Discussion</title>
    <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3011036#M6524</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a custom visual where user can drag the horizontal line which change the column width. Default value is set to 125.&lt;/P&gt;&lt;P&gt;I try to figure out how to ovewrite the default value from property panel like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipwydra_0-1673349406483.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/852574i6067BFE3D6F3320B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipwydra_0-1673349406483.png" alt="filipwydra_0-1673349406483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try to overwite the value this way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.settings.columnProps.column_one = currentLines[0].getBoundingClientRect().left;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... but it doesn't work. When refresh the report the value back to default.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any API or ready solution to do this ? Can I use come kind of local storage ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for any help!&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 11:25:53 GMT</pubDate>
    <dc:creator>filipwydra</dc:creator>
    <dc:date>2023-01-10T11:25:53Z</dc:date>
    <item>
      <title>Overwrite default value from property panel</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3011036#M6524</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a custom visual where user can drag the horizontal line which change the column width. Default value is set to 125.&lt;/P&gt;&lt;P&gt;I try to figure out how to ovewrite the default value from property panel like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipwydra_0-1673349406483.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/852574i6067BFE3D6F3320B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipwydra_0-1673349406483.png" alt="filipwydra_0-1673349406483.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did try to overwite the value this way:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.settings.columnProps.column_one = currentLines[0].getBoundingClientRect().left;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;... but it doesn't work. When refresh the report the value back to default.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any API or ready solution to do this ? Can I use come kind of local storage ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 11:25:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3011036#M6524</guid>
      <dc:creator>filipwydra</dc:creator>
      <dc:date>2023-01-10T11:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite default value from property panel</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3012803#M6532</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/329928"&gt;@filipwydra&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;When properties are loaded into your visual from the pane, they are not bi-directional, so if you're updating a value in your visual, it will not be written back to the main window (which is where your visual properties are persisted so they can be restored when your visual re-initialises). If you wish to programmatically update them from within your visual, you will need to use the &lt;A href="https://learn.microsoft.com/en-us/power-bi/developer/visuals/visual-api#:~:text=see%20Filter%20API-,persistProperties,-%2C%20allows%20users%20to" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;persistProperties&lt;/FONT&gt; method from the visual host&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;This object is only grabbable when your visual is initialised, so when your &lt;FONT face="courier new,courier"&gt;constructor&lt;/FONT&gt; runs,&amp;nbsp;store the &lt;FONT face="courier new,courier"&gt;options.host&lt;/FONT&gt; object in a variable that can be accessed within your visual and then use this method to update the visual properties accordingly. When building your&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier"&gt;VisualObjectInstancesToPersist&lt;/FONT&gt; object, I'd suggest using &lt;FONT face="courier new,courier"&gt;merge&lt;/FONT&gt; as the desired instance, as this will create or replace the property (rather than &lt;FONT face="courier new,courier"&gt;replace&lt;/FONT&gt;, which assumes the property value already exists).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The visual host service is useful for other things that require communication with the main window, such as creating selectors (for cross-filtering and tooltips), and the &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/bb511624cc330d47554cbf80b119199194f5235e/src/visuals-api.d.ts#L1686" target="_self"&gt;API for &lt;FONT face="courier new,courier"&gt;IVisualHost&lt;/FONT&gt; is visible here in the powerbi-visuals-api repo&lt;/A&gt; (although you can view it in VS Code by inspecting &lt;FONT face="courier new,courier"&gt;VisualConstructorOptions&lt;/FONT&gt; definition and following through also).&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jan 2023 04:32:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3012803#M6532</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2023-01-11T04:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite default value from property panel</title>
      <link>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3016530#M6545</link>
      <description>&lt;P&gt;Daniel (&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt;&amp;nbsp;), this is exactly what I need. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2023 10:54:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Custom-Visuals-Development/Overwrite-default-value-from-property-panel/m-p/3016530#M6545</guid>
      <dc:creator>filipwydra</dc:creator>
      <dc:date>2023-01-12T10:54:59Z</dc:date>
    </item>
  </channel>
</rss>

