<?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 Custom visual selection: values in the selector are reset in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-visual-selection-values-in-the-selector-are-reset/m-p/780296#M20571</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hi power bi community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By following the tutorial for creation of barChart (&lt;A href="https://github.com/microsoft/PowerBI-visuals-sampleBarChart" target="_blank"&gt;https://github.com/microsoft/PowerBI-visuals-sampleBarChart&lt;/A&gt;), I have created two selectors A and B. If I filter the data only by selector "A", everything works good. But if click on value at selector "A" and then I select value at the selector "B", the selection in the filter "A" is reset (the array with the id of the selected elements becomes empty).&lt;/P&gt;&lt;P&gt;What could be the problem?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Aug 2019 13:45:58 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-08-30T13:45:58Z</dc:date>
    <item>
      <title>Custom visual selection: values in the selector are reset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-visual-selection-values-in-the-selector-are-reset/m-p/780296#M20571</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi power bi community,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By following the tutorial for creation of barChart (&lt;A href="https://github.com/microsoft/PowerBI-visuals-sampleBarChart" target="_blank"&gt;https://github.com/microsoft/PowerBI-visuals-sampleBarChart&lt;/A&gt;), I have created two selectors A and B. If I filter the data only by selector "A", everything works good. But if click on value at selector "A" and then I select value at the selector "B", the selection in the filter "A" is reset (the array with the id of the selected elements becomes empty).&lt;/P&gt;&lt;P&gt;What could be the problem?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Aug 2019 13:45:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-visual-selection-values-in-the-selector-are-reset/m-p/780296#M20571</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-08-30T13:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Custom visual selection: values in the selector are reset</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-visual-selection-values-in-the-selector-are-reset/m-p/781598#M20588</link>
      <description>&lt;P&gt;As discussed privately, I haven't got much experience in this area, but I have had a quick look, and if you're using &lt;A href="https://github.com/microsoft/PowerBI-visuals-sampleBarChart/blob/master/Tutorial/Selection.md" target="_self"&gt;this tutorial&lt;/A&gt;, then I think that it's a case of enabling &lt;FONT face="courier new,courier"&gt;multiSelect&lt;/FONT&gt; on your &lt;FONT face="courier new,courier"&gt;select&lt;/FONT&gt; call.&lt;/P&gt;&lt;P&gt;You can see the specification for the &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/master/index.d.ts#L1239" target="_self"&gt;&lt;FONT face="courier new,courier"&gt;select&lt;/FONT&gt; method in &lt;FONT face="courier new,courier"&gt;ISelectionManager&lt;/FONT&gt; here&lt;/A&gt;. Notice that there is an optional &lt;FONT face="courier new,courier"&gt;multiSelect&lt;/FONT&gt; property.&lt;/P&gt;&lt;P&gt;I've checked out the sample repo and can't get it to compile to verify, unfortunately, but I presume that your code would need to look as follows (based on the tutorial; change higlighted in red):&lt;/P&gt;&lt;PRE&gt;let selectionManager = this.selectionManager;

//This must be an anonymous function instead of a lambda because
//d3 uses 'this' as the reference to the element that was clicked.
bars.on('click', function(d) {
    selectionManager.select(d.selectionId&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;, true&lt;/FONT&gt;&lt;/STRONG&gt;).then((ids: ISelectionId[]) =&amp;gt; {
        bars.attr({
            'fill-opacity': ids.length &amp;gt; 0 ? BarChart.Config.transparentOpacity : BarChart.Config.solidOpacity
        });

        d3.select(this).attr({
            'fill-opacity': BarChart.Config.solidOpacity
        });
    });

    (&amp;lt;Event&amp;gt;d3.event).stopPropagation();
});&lt;/PRE&gt;&lt;P&gt;There's also &lt;A href="https://www.youtube.com/playlist?list=PL6z9i4iVbl8C2mtjFlH3ECb3q00eFDLAG" target="_self"&gt;a great series on YouTube that works through a similar tutorial&lt;/A&gt;. It's for an older version of the SDK but a lot of the concepts still work. &lt;A href="https://www.youtube.com/watch?v=ac4VoH3U5LQ&amp;amp;list=PL6z9i4iVbl8C2mtjFlH3ECb3q00eFDLAG&amp;amp;index=12&amp;amp;t=6m52s" target="_self"&gt;Here's a timestamped-link to where the above is illustrated&lt;/A&gt;, but the whole video is worth watching IMHO as it includes functionality such as dimming unselected data points.&lt;/P&gt;&lt;P&gt;Hopefully this should give you some options to explore. Good luck!&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 20:44:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-visual-selection-values-in-the-selector-are-reset/m-p/781598#M20588</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2019-09-02T20:44:00Z</dc:date>
    </item>
  </channel>
</rss>

