<?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 pass variables to a deferred infoWindow function in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484145#M45126</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;using a closure for vars you want to access inside your function.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Derek,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you elaborate on that suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 May 2011 02:46:47 GMT</pubDate>
    <dc:creator>StephenLead</dc:creator>
    <dc:date>2011-05-26T02:46:47Z</dc:date>
    <item>
      <title>How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484143#M45124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The sample at &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/widget_infowindowdeferred.html"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/widget_infowindowdeferred.html&lt;/A&gt;&lt;SPAN&gt; shows how to run a function to format the contents of an infoWindow.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It says "a function (getTextContent) is defined that will execute when a [feature] is clicked" and "In the getTextContent function we have access to the clicked graphic".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The content of the infoWindow is set with:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;template.setContent(getTextContent);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the function references the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;graphic &lt;/SPAN&gt;&lt;SPAN&gt;object using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;function getTextContent(graphic) {&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to pass other variables into this function, so that they could be used within the function?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 May 2011 22:46:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484143#M45124</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2011-05-25T22:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484144#M45125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't know of a way to do this...I think you're stuck referring to global variables or using a closure for vars you want to access inside your function.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2011 02:16:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484144#M45125</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2011-05-26T02:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484145#M45126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;using a closure for vars you want to access inside your function.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Derek,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you elaborate on that suggestion?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2011 02:46:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484145#M45126</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2011-05-26T02:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484146#M45127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually stack overflow has a good thread which should help me out here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://stackoverflow.com/questions/111102/how-do-javascript-closures-work"&gt;http://stackoverflow.com/questions/111102/how-do-javascript-closures-work&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2011 02:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484146#M45127</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2011-05-26T02:53:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484147#M45128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hey Steve,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was implying that you could wrap the function you pass to setContent in another function. That way, variables you define in the function that wraps the function passed to setContent are accessible in the setContent function. It's not exactly what you asked for but is one way to avoid using globals.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 May 2011 03:13:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484147#M45128</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2011-05-26T03:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass variables to a deferred infoWindow function</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484148#M45129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;My brilliant colleague Danny came up with the resolution:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("title");
infoTemplate.x = "abc";
infoTemplate.setContent(buildChart);

function buildChart(graphic) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var x = this.x;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This allows you to access the value "abc" from within the buildChart function. Genius.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:21:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-pass-variables-to-a-deferred-infowindow/m-p/484148#M45129</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2021-12-11T21:21:30Z</dc:date>
    </item>
  </channel>
</rss>

