<?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: General function to set selection state of another app for mashups in Integration, Extension &amp; APIs</title>
    <link>https://community.qlik.com/t5/Integration-Extension-APIs/General-function-to-set-selection-state-of-another-app-for/m-p/1656731#M11979</link>
    <description>&lt;P&gt;Found a work-around but not that happy with it.&amp;nbsp; Instead of an argument I set a global scope var to the application:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	var theApp;

	function stateListener() {	 	
		theApp.clearAll();
		var selFields = this.selections;

		if (selFields!=null){
		$.each(selFields, function(key, value) {
			var valArray=[];
			$.each(value.selectedValues, function(key,value){
				valArray.push(value.qName);
			})
			theApp.field(value.fieldName).selectValues(valArray, true, true);
		});
		}		
	}&lt;/LI-CODE&gt;&lt;P&gt;and use the function like:&lt;/P&gt;&lt;P&gt;var selState = app.selectionState( ); //get state of app&lt;BR /&gt;theApp = app1; //set global to app1&lt;BR /&gt;selState.OnData.bind( stateListener ); //bind to function&lt;/P&gt;</description>
    <pubDate>Wed, 11 Dec 2019 19:22:45 GMT</pubDate>
    <dc:creator>jgunders</dc:creator>
    <dc:date>2019-12-11T19:22:45Z</dc:date>
    <item>
      <title>General function to set selection state of another app for mashups</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/General-function-to-set-selection-state-of-another-app-for/m-p/1655673#M11968</link>
      <description>&lt;P&gt;Trying to write a general function to set the selection state in another app when writing mashups.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	var stateListener = function(theApp) {	 	
	theApp.clearAll();
    	var selFields = this.selections;
		
		if (selFields!=null){
		$.each(selFields, function(key, value) {
			var valArray=[];
			$.each(value.selectedValues, function(key,value){
				valArray.push(value.qName);
			})
			theApp.field(value.fieldName).selectValues(valArray, true, true);
		});
		}		
  	};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So trying to use it like this:&lt;/P&gt;&lt;P&gt;var selState = app.selectionState( );&amp;nbsp;&amp;nbsp;&amp;nbsp; //get state of app&lt;/P&gt;&lt;P&gt;selState.OnData.bind( stateListener, app1 );&amp;nbsp;&amp;nbsp;&amp;nbsp; //bind to function with argument of app1 to set it's state&lt;/P&gt;&lt;P&gt;But it's not calling the listener.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideas appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 21:03:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/General-function-to-set-selection-state-of-another-app-for/m-p/1655673#M11968</guid>
      <dc:creator>jgunders</dc:creator>
      <dc:date>2019-12-09T21:03:41Z</dc:date>
    </item>
    <item>
      <title>Re: General function to set selection state of another app for mashups</title>
      <link>https://community.qlik.com/t5/Integration-Extension-APIs/General-function-to-set-selection-state-of-another-app-for/m-p/1656731#M11979</link>
      <description>&lt;P&gt;Found a work-around but not that happy with it.&amp;nbsp; Instead of an argument I set a global scope var to the application:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	var theApp;

	function stateListener() {	 	
		theApp.clearAll();
		var selFields = this.selections;

		if (selFields!=null){
		$.each(selFields, function(key, value) {
			var valArray=[];
			$.each(value.selectedValues, function(key,value){
				valArray.push(value.qName);
			})
			theApp.field(value.fieldName).selectValues(valArray, true, true);
		});
		}		
	}&lt;/LI-CODE&gt;&lt;P&gt;and use the function like:&lt;/P&gt;&lt;P&gt;var selState = app.selectionState( ); //get state of app&lt;BR /&gt;theApp = app1; //set global to app1&lt;BR /&gt;selState.OnData.bind( stateListener ); //bind to function&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2019 19:22:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Integration-Extension-APIs/General-function-to-set-selection-state-of-another-app-for/m-p/1656731#M11979</guid>
      <dc:creator>jgunders</dc:creator>
      <dc:date>2019-12-11T19:22:45Z</dc:date>
    </item>
  </channel>
</rss>

