<?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 Slicer - Selection Issue in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Selection-Issue/m-p/371992#M11094</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm relatively new to developing custom visuals for PowerBI,&amp;nbsp;and I've started with a slicer. I'm running into a weird issue that's probably best described with an image:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/21d1cdafad8cd7a2bf7e4aab9bfb466a60279b9c/68747470733a2f2f692e696d6775722e636f6d2f626a786a674b342e706e67" border="0" alt="Custom Slicers" width="582" height="578" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hoping this is enough to go on. Note that&amp;nbsp;correct numbers are returned using my slicer, but it feels more like a 'visibility:hidden' than a 'display:none', if that even approaches a worthwhile analogy &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the selection code - I removed the UI code, settings, and pretty much everything else, since it seems to be *almost* working and I'm convinced it's an issue with how I'm selecting:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {

    export class Visual implements IVisual {

        private host: IVisualHost;
        private selectionManager: ISelectionManager;
        private selectionIds: any = {};

        constructor(options: VisualConstructorOptions) {
            
            this.host = options.host;
            this.selectionManager = options.host.createSelectionManager();
        
        }

        // called by update on load and on settings change
        public init(options: VisualUpdateOptions) {
            
            this.selectionIds = {};
            const category = options.dataViews[0].categorical.categories[0];
            const values = category.values;

            values.forEach((item: number, index: number) =&amp;gt; {
            
                this.selectionIds[item.toString()] = this.host.createSelectionIdBuilder()
                    .withCategory(category, index)
                    .createSelectionId();

                let value = item.toString(); // 'Adults 25-54' or 'Individuals 2+'

                // this holds the 'checkbox' and label UI elements
                const inputContainer = document.createElement('div');

                inputContainer.onclick = function (ev) {
                    
                    this.selectionManager.clear();
                    this.selectionManager.select(this.selectionIds[value]).then((ids: ISelectionId[]) =&amp;gt; { });
                    this.selectionManager.applySelectionFilter();

                }.bind(this);

            });

        } 

    } // class

} // module&lt;/PRE&gt;&lt;P&gt;My first thought&amp;nbsp;is&amp;nbsp;that maybe I need to use the interactivity utils, but after digging around in chiclet's source and a few other resources, I figured it might be faster to post here and see if someone can put things into focus for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;</description>
    <pubDate>Thu, 08 Mar 2018 04:17:53 GMT</pubDate>
    <dc:creator>PBI_Rob</dc:creator>
    <dc:date>2018-03-08T04:17:53Z</dc:date>
    <item>
      <title>Custom Slicer - Selection Issue</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Selection-Issue/m-p/371992#M11094</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm relatively new to developing custom visuals for PowerBI,&amp;nbsp;and I've started with a slicer. I'm running into a weird issue that's probably best described with an image:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ip1.i.lithium.com/21d1cdafad8cd7a2bf7e4aab9bfb466a60279b9c/68747470733a2f2f692e696d6775722e636f6d2f626a786a674b342e706e67" border="0" alt="Custom Slicers" width="582" height="578" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm hoping this is enough to go on. Note that&amp;nbsp;correct numbers are returned using my slicer, but it feels more like a 'visibility:hidden' than a 'display:none', if that even approaches a worthwhile analogy &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the selection code - I removed the UI code, settings, and pretty much everything else, since it seems to be *almost* working and I'm convinced it's an issue with how I'm selecting:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;module powerbi.extensibility.visual {

    export class Visual implements IVisual {

        private host: IVisualHost;
        private selectionManager: ISelectionManager;
        private selectionIds: any = {};

        constructor(options: VisualConstructorOptions) {
            
            this.host = options.host;
            this.selectionManager = options.host.createSelectionManager();
        
        }

        // called by update on load and on settings change
        public init(options: VisualUpdateOptions) {
            
            this.selectionIds = {};
            const category = options.dataViews[0].categorical.categories[0];
            const values = category.values;

            values.forEach((item: number, index: number) =&amp;gt; {
            
                this.selectionIds[item.toString()] = this.host.createSelectionIdBuilder()
                    .withCategory(category, index)
                    .createSelectionId();

                let value = item.toString(); // 'Adults 25-54' or 'Individuals 2+'

                // this holds the 'checkbox' and label UI elements
                const inputContainer = document.createElement('div');

                inputContainer.onclick = function (ev) {
                    
                    this.selectionManager.clear();
                    this.selectionManager.select(this.selectionIds[value]).then((ids: ISelectionId[]) =&amp;gt; { });
                    this.selectionManager.applySelectionFilter();

                }.bind(this);

            });

        } 

    } // class

} // module&lt;/PRE&gt;&lt;P&gt;My first thought&amp;nbsp;is&amp;nbsp;that maybe I need to use the interactivity utils, but after digging around in chiclet's source and a few other resources, I figured it might be faster to post here and see if someone can put things into focus for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot!&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 04:17:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Selection-Issue/m-p/371992#M11094</guid>
      <dc:creator>PBI_Rob</dc:creator>
      <dc:date>2018-03-08T04:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Slicer - Selection Issue</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Selection-Issue/m-p/372686#M11116</link>
      <description>&lt;P&gt;I believe I've resolved the issue. In case someone else runs into something similar, I added the &lt;A href="https://github.com/Microsoft/powerbi-visuals-sampleslicer/blob/master/doc/AddingInteractivityUtils.md" target="_blank"&gt;Advanced Filter API&lt;/A&gt;. That's it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The "filter" addition to the capabilities file&amp;nbsp;seems to&amp;nbsp;be the difference between the original and expected behaviours.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 22:10:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Slicer-Selection-Issue/m-p/372686#M11116</guid>
      <dc:creator>PBI_Rob</dc:creator>
      <dc:date>2018-03-08T22:10:31Z</dc:date>
    </item>
  </channel>
</rss>

