<?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: Issue implementing a context menu in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1365610#M25684</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt; and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313"&gt;@Greg_Deckler&lt;/a&gt;&amp;nbsp;for your suggestions. Neither quite worked for me. Pardon my lack of experience, but EventTarget does not appear to have any attributes, leading me to think one needs to use that reference in some selector to get at the attributes. Setting the type like this&amp;nbsp;let dataPoint = d3.select(&amp;lt;d3.BaseType&amp;gt;eventTarget).datum(); worked somewhat, but then dataPoint did not have a selectionId attribute. Seems like d3.select wants the selector to be a string. Ultimately, I solved the problem by cheating. Since I only want one context menu to appear no matter where the user clicks, I hard-coded the reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;svg.on('contextmenu', () =&amp;gt; {&lt;BR /&gt;const mouseEvent: MouseEvent = d3.event as MouseEvent;&lt;BR /&gt;let dataPoint: any = d3.select("svg").datum();&lt;BR /&gt;this.selectionManager.showContextMenu(dataPoint ? dataPoint.selectionId : {}, {&lt;BR /&gt;x: mouseEvent.clientX,&lt;BR /&gt;y: mouseEvent.clientY&lt;BR /&gt;});&lt;BR /&gt;mouseEvent.preventDefault();&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;</description>
    <pubDate>Fri, 11 Sep 2020 21:36:36 GMT</pubDate>
    <dc:creator>angelflight</dc:creator>
    <dc:date>2020-09-11T21:36:36Z</dc:date>
    <item>
      <title>Issue implementing a context menu</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1362862#M25673</link>
      <description>&lt;P&gt;I am trying to add a context menu to my visual, and I'm using the example provided here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/microsoft/PowerBI-visuals/blob/gh-pages/tutorials/building-bar-chart/adding-context-menu-to-the-bar.md" target="_blank" rel="noopener"&gt;https://github.com/microsoft/PowerBI-visuals/blob/gh-pages/tutorials/building-bar-chart/adding-context-menu-to-the-bar.md&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; svg.on('contextmenu', () =&amp;gt; {&lt;BR /&gt;const mouseEvent: MouseEvent = d3.event as MouseEvent;&lt;BR /&gt;const eventTarget: EventTarget = mouseEvent.target;&lt;BR /&gt;let dataPoint = d3.select(eventTarget).datum();&lt;BR /&gt;this.selectionManager.showContextMenu(dataPoint ? dataPoint.selectionId : {}, {&lt;BR /&gt;x: mouseEvent.clientX,&lt;BR /&gt;y: mouseEvent.clientY&lt;BR /&gt;});&lt;BR /&gt;mouseEvent.preventDefault();&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;I am getting this error referring to the use of eventTarget in the d3.select:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="angelflight_0-1599785229322.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/353404i28C6528DA9BA0B1E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="angelflight_0-1599785229322.png" alt="angelflight_0-1599785229322.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;TS2769: No overload matches this call.&lt;BR /&gt;Overload 1 of 2, '(selector: string): Selection&amp;lt;BaseType, unknown, HTMLElement, any&amp;gt;', gave the following error.&lt;BR /&gt;Argument of type 'EventTarget' is not assignable to parameter of type 'string'.&lt;BR /&gt;Overload 2 of 2, '(node: BaseType): Selection&amp;lt;BaseType, unknown, null, undefined&amp;gt;', gave the following error.&lt;BR /&gt;Argument of type 'EventTarget' is not assignable to parameter of type 'BaseType'.&lt;BR /&gt;Type 'EventTarget' is missing the following properties from type 'Window': applicationCache, clientInformation, closed, customElements, and 221 more.&amp;nbsp;&lt;/P&gt;&lt;P&gt;'&lt;/P&gt;&lt;P&gt;Any help/guidance would be appreciated....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stephan&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 00:48:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1362862#M25673</guid>
      <dc:creator>angelflight</dc:creator>
      <dc:date>2020-09-11T00:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Issue implementing a context menu</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1362885#M25674</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/246887"&gt;@angelflight&lt;/a&gt;&amp;nbsp; If I am reading that right, it's a type mistmatch situation. eventTarget is an EventTarget object and not a string. My guess is that you need to access an attribute of eventTarget like eventTarget.attribute ?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 01:02:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1362885#M25674</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-11T01:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue implementing a context menu</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1363195#M25678</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/246887"&gt;@angelflight&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Try casting your &lt;FONT face="courier new,courier"&gt;eventTarget&lt;/FONT&gt; to &lt;FONT face="courier new,courier"&gt;d3.BaseType&lt;/FONT&gt;, e.g.:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;let dataPoint = d3.select(&amp;lt;d3.BaseType&amp;gt;eventTarget).datum();&lt;/LI-CODE&gt;
&lt;P&gt;&lt;A href="https://github.com/dm-p/powerbi-visuals-smlc/blob/master/src/dom/ChartHelper.ts#L429" target="_self"&gt;Here's the pointer to a working example in one of my visuals&lt;/A&gt; for context.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Daniel&lt;/P&gt;
&lt;DIV id="kpm-root" class="kpm_LTR notranslate" translate="no"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 11 Sep 2020 02:58:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1363195#M25678</guid>
      <dc:creator>dm-p</dc:creator>
      <dc:date>2020-09-11T02:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Issue implementing a context menu</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1365610#M25684</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/397"&gt;@dm-p&lt;/a&gt; and&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/313"&gt;@Greg_Deckler&lt;/a&gt;&amp;nbsp;for your suggestions. Neither quite worked for me. Pardon my lack of experience, but EventTarget does not appear to have any attributes, leading me to think one needs to use that reference in some selector to get at the attributes. Setting the type like this&amp;nbsp;let dataPoint = d3.select(&amp;lt;d3.BaseType&amp;gt;eventTarget).datum(); worked somewhat, but then dataPoint did not have a selectionId attribute. Seems like d3.select wants the selector to be a string. Ultimately, I solved the problem by cheating. Since I only want one context menu to appear no matter where the user clicks, I hard-coded the reference:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;svg.on('contextmenu', () =&amp;gt; {&lt;BR /&gt;const mouseEvent: MouseEvent = d3.event as MouseEvent;&lt;BR /&gt;let dataPoint: any = d3.select("svg").datum();&lt;BR /&gt;this.selectionManager.showContextMenu(dataPoint ? dataPoint.selectionId : {}, {&lt;BR /&gt;x: mouseEvent.clientX,&lt;BR /&gt;y: mouseEvent.clientY&lt;BR /&gt;});&lt;BR /&gt;mouseEvent.preventDefault();&lt;BR /&gt;});&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Sep 2020 21:36:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Issue-implementing-a-context-menu/m-p/1365610#M25684</guid>
      <dc:creator>angelflight</dc:creator>
      <dc:date>2020-09-11T21:36:36Z</dc:date>
    </item>
  </channel>
</rss>

