<?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: Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'. in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551503#M36444</link>
    <description>&lt;P&gt;Oh wow. Thanks.&lt;/P&gt;&lt;P&gt;That was it.&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 01:13:47 GMT</pubDate>
    <dc:creator>dunkyboy</dc:creator>
    <dc:date>2022-06-01T01:13:47Z</dc:date>
    <item>
      <title>Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551475#M36442</link>
      <description>&lt;P&gt;I'm receiving this error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'."&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm attempting to create a custom visual on a table. This is following the Microsoft documentation here.&lt;A href="https://docs.microsoft.com/en-us/power-bi/developer/visuals/selection-api" target="_blank" rel="noopener"&gt;https://docs.microsoft.com/en-us/power-bi/developer/visuals/selection-api&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using API version: 3.8.0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error causing code is at:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const selectionId: ISelectionId = this.host.createSelectionIdBuilder()
   .withTable(dataView.table, rowIndex)
   .createSelectionId();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;"use strict";

import "./../style/visual.less";
import powerbi from "powerbi-visuals-api";
import VisualConstructorOptions = powerbi.extensibility.visual.VisualConstructorOptions;
import VisualUpdateOptions = powerbi.extensibility.visual.VisualUpdateOptions;
import IVisual = powerbi.extensibility.visual.IVisual;
import IVisualHost = powerbi.extensibility.IVisualHost;
import ISelectionManager = powerbi.extensibility.ISelectionManager;

import ISelectionIdBuilder = powerbi.extensibility.ISelectionIdBuilder;
import ISelectionId = powerbi.visuals.ISelectionId;

import EnumerateVisualObjectInstancesOptions = powerbi.EnumerateVisualObjectInstancesOptions;
import VisualObjectInstance = powerbi.VisualObjectInstance;
import DataView = powerbi.DataView;
import DataViewTableRow = powerbi.DataViewTableRow;
import VisualObjectInstanceEnumerationObject = powerbi.VisualObjectInstanceEnumerationObject;

import * as d3select from 'd3-selection'

import { VisualSettings } from "./settings";
export class Visual implements IVisual {
    private host: IVisualHost;
    private target: HTMLElement;
    private selectionManager: ISelectionManager;
    private container: d3.Selection&amp;lt;any, any, any, any&amp;gt;;
    private settings: VisualSettings;

    constructor(options: VisualConstructorOptions) {
        console.log('Visual constructor', options);
        this.host = options.host;
       
        this.container = d3select.select(options.element)
            .append('table');
        this.selectionManager = options.host.createSelectionManager();
    }

    public update(options: VisualUpdateOptions) {
        this.settings = Visual.parseSettings(options &amp;amp;&amp;amp; options.dataViews &amp;amp;&amp;amp; options.dataViews[0]);
        console.log('Visual update', options);
        this.container.selectAll('*').remove();

        let dataViews = options.dataViews;

        //
        const dataView = options.dataViews[0];
        dataView.table.rows.forEach((row: DataViewTableRow, rowIndex: number) =&amp;gt; {

        });

        let table = dataViews[0].table;

        let tHead = this.container
            .append('tr');

        table.columns.forEach(
            (col) =&amp;gt; {
                tHead.append('th').text(col.displayName);
            },
            
        );
        tHead.append('th').text('Test')


        table.rows.forEach(
            (row: DataViewTableRow, rowIndex: number) =&amp;gt; {
                let tRow = this.container
                    .append('tr');
                row.forEach(

                    (col) =&amp;gt; {
                        tRow.append('td')
                            .text(col.toString());
                    },


                )
                // this.target.appendChild(rowDiv);
                const selectionId: ISelectionId = this.host.createSelectionIdBuilder()
                    .withTable(dataView.table, rowIndex)
                    .createSelectionId();
                // tRow.append('td').text(this.container.select('a').text);
                // tRow.append('td').text('ttt');
            }
        );

    }

    private static parseSettings(dataView: DataView): VisualSettings {
        return &amp;lt;VisualSettings&amp;gt;VisualSettings.parse(dataView);
    }

    /**
     * This function gets called for each of the objects defined in the capabilities files and allows you to select which of the
     * objects and properties you want to expose to the users in the property pane.
     *
     */
    public enumerateObjectInstances(options: EnumerateVisualObjectInstancesOptions): VisualObjectInstance[] | VisualObjectInstanceEnumerationObject {
        return VisualSettings.enumerateObjectInstances(this.settings || VisualSettings.getDefault(), options);
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 00:37:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551475#M36442</guid>
      <dc:creator>dunkyboy</dc:creator>
      <dc:date>2022-06-01T00:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551496#M36443</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/254241"&gt;@dunkyboy&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;The error is on line 8 - you're importing an &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/502742df7a8ccbb4236dea0fafdd659ec8baa201/index.d.ts#L1233" target="_self"&gt;IVisualHost with no methods exposed in its typings&lt;/A&gt;. IIRC this is here for backwards compatibility with a previous version of the SDK, and the documentation may be slightly out of date.&lt;/P&gt;
&lt;P&gt;If you change the line as follows to include &lt;A href="https://github.com/microsoft/powerbi-visuals-api/blob/502742df7a8ccbb4236dea0fafdd659ec8baa201/index.d.ts#L1500" target="_self"&gt;the correct interface&lt;/A&gt;, it will work:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;import IVisualHost = powerbi.extensibility.visual.IVisualHost;&lt;/LI-CODE&gt;
&lt;P&gt;This will now expose the correct interface to your property and the &lt;FONT face="courier new,courier"&gt;createSelectionIdBuilder()&lt;/FONT&gt; method will be available (I've tested your code with this and it works fine for me).&lt;/P&gt;
&lt;P&gt;Good luck!&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 01:10:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551496#M36443</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2022-06-01T01:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551503#M36444</link>
      <description>&lt;P&gt;Oh wow. Thanks.&lt;/P&gt;&lt;P&gt;That was it.&lt;/P&gt;&lt;P&gt;D&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 01:13:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551503#M36444</guid>
      <dc:creator>dunkyboy</dc:creator>
      <dc:date>2022-06-01T01:13:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551599#M36449</link>
      <description>&lt;P&gt;Glad to hear it! Could I please trouble you to mark that post as the solution so that other community users can find it more quickly in future?&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 02:03:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/2551599#M36449</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2022-06-01T02:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error: Property 'createSelectionIdBuilder' does not exist on type 'IVisualHost'.</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/3338408#M43514</link>
      <description>&lt;P&gt;Thanks for your answer, that was exacly what i was looking for!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2023 11:26:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Error-Property-createSelectionIdBuilder-does-not-exist-on-type/m-p/3338408#M43514</guid>
      <dc:creator>FranciscoFiuza</dc:creator>
      <dc:date>2023-07-19T11:26:28Z</dc:date>
    </item>
  </channel>
</rss>

