<?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: How to get the HtmlElement by Idfrom the current Extension in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064504#M87322</link>
    <description>&lt;P&gt;There's probably a "correct" way to get that ID dynamically from the Capabilities API (or Nebula, whichever you're using underneath the hood).&lt;/P&gt;
&lt;P&gt;I would&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; suggest getting the ID this way, but as a test you can do this:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;let obj = document.querySelector('article.qv-object-googletimeline div[id$="_content"]');
let obj_id = obj.id.split('_')[0];&lt;/LI-CODE&gt;
&lt;P&gt;I made up the&amp;nbsp;&lt;STRONG&gt;googletimeline&lt;/STRONG&gt; part, you'd need to look at the source and see what that object is called.&lt;/P&gt;
&lt;P&gt;Assuming you're using the Capabilities API, you could probably use the&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/APIs/Content/Sense_ClientAPIs/BackendAPI/getproperties-method.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;getProperties()&lt;/STRONG&gt; method&lt;/A&gt; to ultimately get the ID for the object.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Apr 2023 23:13:29 GMT</pubDate>
    <dc:creator>AustinSpivey</dc:creator>
    <dc:date>2023-04-25T23:13:29Z</dc:date>
    <item>
      <title>How to get the HtmlElement by Idfrom the current Extension</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064115#M87287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am&amp;nbsp; trying to create Timeline chart with with reference line for today().&lt;/P&gt;
&lt;P&gt;I use the RebootTimeline extension.but this extension doesnt provide to show the current date vertical line.So i am trying to change this extension to draw a vertical line.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="agnie_john_0-1682415003767.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/105735i438A7858D737EBA8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="agnie_john_0-1682415003767.png" alt="agnie_john_0-1682415003767.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I could achieve this by getting the Html Div element by document.getElementsByTagName("svg").&lt;/P&gt;
&lt;P&gt;The problem here is the id is not dynamic. I manually find the id of the corresponding div by checking the source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to get this id dynamically. Is there anyway to get this details?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Current Logic:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call addMarker function on Chart ready event&lt;/P&gt;
&lt;P&gt;google.visualization.events.addListener(chart, 'ready', function() {&lt;BR /&gt;&lt;BR /&gt;console.log($element);&lt;BR /&gt;dateRangeStart = data.getColumnRange(1);&lt;BR /&gt;dateRangeEnd = data.getColumnRange(2);&lt;BR /&gt;//console.log(this)&lt;BR /&gt;addMarker(new Date());&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the add Marker function i get the div using document.getElementById&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function addMarker(markerDate) {&lt;BR /&gt;var container = &lt;STRONG&gt;document.getElementById('mZHuk_content');&amp;nbsp;&lt;/STRONG&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;BR /&gt;chartElements = container.getElementsByTagName('svg');&lt;BR /&gt;if (chartElements.length &amp;gt; 0) {&lt;BR /&gt;svg = chartElements[0];&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;..&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 09:31:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064115#M87287</guid>
      <dc:creator>agnie_john</dc:creator>
      <dc:date>2023-04-25T09:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the HtmlElement by Idfrom the current Extension</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064504#M87322</link>
      <description>&lt;P&gt;There's probably a "correct" way to get that ID dynamically from the Capabilities API (or Nebula, whichever you're using underneath the hood).&lt;/P&gt;
&lt;P&gt;I would&amp;nbsp;&lt;STRONG&gt;not&lt;/STRONG&gt; suggest getting the ID this way, but as a test you can do this:&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;let obj = document.querySelector('article.qv-object-googletimeline div[id$="_content"]');
let obj_id = obj.id.split('_')[0];&lt;/LI-CODE&gt;
&lt;P&gt;I made up the&amp;nbsp;&lt;STRONG&gt;googletimeline&lt;/STRONG&gt; part, you'd need to look at the source and see what that object is called.&lt;/P&gt;
&lt;P&gt;Assuming you're using the Capabilities API, you could probably use the&amp;nbsp;&lt;A href="https://help.qlik.com/en-US/sense-developer/February2023/Subsystems/APIs/Content/Sense_ClientAPIs/BackendAPI/getproperties-method.htm" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;getProperties()&lt;/STRONG&gt; method&lt;/A&gt; to ultimately get the ID for the object.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Apr 2023 23:13:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064504#M87322</guid>
      <dc:creator>AustinSpivey</dc:creator>
      <dc:date>2023-04-25T23:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the HtmlElement by Idfrom the current Extension</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064928#M87347</link>
      <description>&lt;P&gt;Hello Austin,&lt;/P&gt;
&lt;P&gt;Thanks for you reply.&lt;/P&gt;
&lt;P&gt;I could get the ID from the element like below&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;$element.prevObject.prevObject[0].id&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now my problem is, i could see the marker line on GoogleTimeline chart only if the timeline chart doesn't have the vertical scroll.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="agnie_john_0-1682523068752.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/105906i3EEAD706F2C93A62/image-size/medium?v=v2&amp;amp;px=400" role="button" title="agnie_john_0-1682523068752.png" alt="agnie_john_0-1682523068752.png" /&gt;&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the number of rows increases the vertical scroll is visible at that time the marker is not showing on the timeline chart.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="agnie_john_1-1682523121473.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/105907i0271761CBD8733D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="agnie_john_1-1682523121473.png" alt="agnie_john_1-1682523121473.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;How to achieve the marker even if the Timeline chart has scrollbar?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2023 15:33:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2064928#M87347</guid>
      <dc:creator>agnie_john</dc:creator>
      <dc:date>2023-04-26T15:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the HtmlElement by Idfrom the current Extension</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2065910#M87433</link>
      <description>&lt;P&gt;It looks like when there are few enough items to not require scrolling, the axis and timeline bars are all contained in a single SVG element:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AustinSpivey_0-1682698496056.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106067i8526729558162B34/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AustinSpivey_0-1682698496056.png" alt="AustinSpivey_0-1682698496056.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when there are enough items that scrolling becomes necessary, a second SVG element is generated. The original SVG displays the x-axis values and the second SVG holds the timeline bars:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AustinSpivey_1-1682698693829.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106069iCDA8D1412252C81A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AustinSpivey_1-1682698693829.png" alt="AustinSpivey_1-1682698693829.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;From the above screenshot, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;/FONT&gt; is the original SVG with the axis labels and &lt;FONT color="#FF9900"&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt;&lt;/FONT&gt; is the second SVG with the timeline bars.&lt;/P&gt;
&lt;P&gt;Now, my guess is that you are drawing the x-axis lines&amp;nbsp;&lt;EM&gt;on&lt;/EM&gt; the x-axis SVG &amp;lt;g&amp;gt; which would explain why it's not being shown when there's scrolling: the second SVG element has&amp;nbsp;&lt;STRONG&gt;absolute&lt;/STRONG&gt; positioning and sits on top of the original SVG. They're also "parallel" child nodes so I don't think you can easily fix that with a high&amp;nbsp;&lt;STRONG&gt;z-index&lt;/STRONG&gt; in this case.&lt;/P&gt;
&lt;P&gt;I think one possible solution would be to place your axis lines in a separate SVG element that also has absolute positioning, but with a high z-index so that it is on top of the both the original and the second SVGs that are currently in play.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AustinSpivey_2-1682699221924.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/106070i5D47021EE60A4E9B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AustinSpivey_2-1682699221924.png" alt="AustinSpivey_2-1682699221924.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;From the above screenshot, &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt;&lt;/FONT&gt; is the original SVG with the axis labels and &lt;FONT color="#FF9900"&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt;&lt;/FONT&gt; is the second SVG with the timeline bars, and &lt;FONT color="#800080"&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt;&lt;/FONT&gt; is the new SVG element that holds just your axis lines.&lt;/P&gt;
&lt;P&gt;Note that absolute positioning and use of z-index in that screenshot. I used a really high z-index for that example but you should probably use a more reasonable one so that you don't accidentally break other sheet/mashup UI behaviors.&lt;/P&gt;
&lt;P&gt;For reference, this is the SVG element code I use in that example:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;svg width="713" height="277" aria-label="A chart." style="overflow: hidden; position: absolute; top: 0; left: 0;"&amp;gt;
    &amp;lt;defs id="_ABSTRACT_RENDERER_ID_117"&amp;gt;&amp;lt;/defs&amp;gt;
    &amp;lt;g&amp;gt;
        &amp;lt;line
            style="stroke: rgb(255, 0, 0); stroke-width: 4; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0, 0, 0); fill-rule: nonzero; opacity: 1;"
            vector-effect="non-scaling-stroke"
            x1="600"
            y1="0"
            x2="600"
            y2="250"
        &amp;gt;&amp;lt;/line&amp;gt;
    &amp;lt;/g&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Apr 2023 16:32:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-get-the-HtmlElement-by-Idfrom-the-current-Extension/m-p/2065910#M87433</guid>
      <dc:creator>AustinSpivey</dc:creator>
      <dc:date>2023-04-28T16:32:00Z</dc:date>
    </item>
  </channel>
</rss>

