<?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 Selections not populated after reload? in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1660551#M12050</link>
    <description>&lt;P&gt;(Edited to add code and images.)&lt;/P&gt;&lt;P&gt;In my extension's paint() method, I am accessing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selectionState().selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array. All seems to work fine generally, but when I do a reload of the webpage, the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array is empty when&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;paint()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is called. A subsequent interaction that causes&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;paint()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to be called again finds the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array populated.&lt;/P&gt;&lt;P&gt;Have I got some sort of race condition where the app has yet to load/cache the current selections?&lt;/P&gt;&lt;P&gt;Here is some sample code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;define(["qlik","css!./styles.css"], function (qlik) {

	return {
		support : {
			snapshot: false,
			export: false,
			exportData : false
		},
		paint: function ($element) {
			console.log(qlik.currApp().selectionState());
			console.log(qlik.currApp().selectionState().selections);

			return qlik.Promise.resolve();
		}
	};
} );&lt;/LI-CODE&gt;&lt;P&gt;And here are images demonstrating my issue:&lt;/P&gt;&lt;P&gt;1. I currently have three Fields (4 Field Values) selected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Annotation 2019-12-27 081422.png" style="width: 652px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26084i3BA7FF40579D17DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081422.png" alt="Annotation 2019-12-27 081422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. When I reload my JS console shows the following. Note the highlighted parts.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-12-27 081423.png" style="width: 913px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26085iEA9F7C4F5835032C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081423.png" alt="Annotation 2019-12-27 081423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. When I then open those interactively in the console, they are populated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-12-27 081424.png" style="width: 925px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26086i9B47F097C161DAAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081424.png" alt="Annotation 2019-12-27 081424.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thus, at the time paint() is called, my extension does not have the correct information about what is selected.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:43:53 GMT</pubDate>
    <dc:creator>BradMazurek</dc:creator>
    <dc:date>2024-11-16T03:43:53Z</dc:date>
    <item>
      <title>Selections not populated after reload?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1660551#M12050</link>
      <description>&lt;P&gt;(Edited to add code and images.)&lt;/P&gt;&lt;P&gt;In my extension's paint() method, I am accessing the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selectionState().selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array. All seems to work fine generally, but when I do a reload of the webpage, the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array is empty when&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;paint()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is called. A subsequent interaction that causes&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;paint()&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to be called again finds the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;selections&lt;/FONT&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array populated.&lt;/P&gt;&lt;P&gt;Have I got some sort of race condition where the app has yet to load/cache the current selections?&lt;/P&gt;&lt;P&gt;Here is some sample code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;define(["qlik","css!./styles.css"], function (qlik) {

	return {
		support : {
			snapshot: false,
			export: false,
			exportData : false
		},
		paint: function ($element) {
			console.log(qlik.currApp().selectionState());
			console.log(qlik.currApp().selectionState().selections);

			return qlik.Promise.resolve();
		}
	};
} );&lt;/LI-CODE&gt;&lt;P&gt;And here are images demonstrating my issue:&lt;/P&gt;&lt;P&gt;1. I currently have three Fields (4 Field Values) selected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="Annotation 2019-12-27 081422.png" style="width: 652px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26084i3BA7FF40579D17DD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081422.png" alt="Annotation 2019-12-27 081422.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. When I reload my JS console shows the following. Note the highlighted parts.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-12-27 081423.png" style="width: 913px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26085iEA9F7C4F5835032C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081423.png" alt="Annotation 2019-12-27 081423.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;3. When I then open those interactively in the console, they are populated.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Annotation 2019-12-27 081424.png" style="width: 925px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/26086i9B47F097C161DAAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Annotation 2019-12-27 081424.png" alt="Annotation 2019-12-27 081424.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thus, at the time paint() is called, my extension does not have the correct information about what is selected.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:43:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1660551#M12050</guid>
      <dc:creator>BradMazurek</dc:creator>
      <dc:date>2024-11-16T03:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: Selections not populated after reload?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1660629#M12051</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;can you please provide demo of your code?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Harsh Gohil&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2019 04:28:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1660629#M12051</guid>
      <dc:creator>Harsh_Gohil</dc:creator>
      <dc:date>2019-12-26T04:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Selections not populated after reload?</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1661586#M12058</link>
      <description>&lt;P&gt;I think I figured it out.&lt;/P&gt;&lt;P&gt;The selections may not yet be loaded, so I should bind a listener to&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;qlik.currApp().selectionState().OnData&lt;/LI-CODE&gt;&lt;P&gt;I would suggest the documentation be updated to indicate a few things:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The content of&amp;nbsp;&lt;SPAN&gt;qlik.app.selectionState() is indeterminate until after an OnData event is received any associated listeners.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Some indication of under what circumstances the OnData event is triggered. (Obviously during a selection, but also during page load. Are there more cases?)&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 30 Dec 2019 20:42:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/Selections-not-populated-after-reload/m-p/1661586#M12058</guid>
      <dc:creator>BradMazurek</dc:creator>
      <dc:date>2019-12-30T20:42:59Z</dc:date>
    </item>
  </channel>
</rss>

