<?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: Selecting PDF to view from datagrid result in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751715#M69503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tom, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks much for the response.&amp;nbsp; For the time being, I decided to keep it simple and create multiple features for each record.&amp;nbsp; Basically I had multi-part features that were causing me confusion with the programming.&amp;nbsp; My next step is to create a button that will launch the raster, so keeping it simple will help with that too.&amp;nbsp;&amp;nbsp; Just a bit easier for me to wrap my mind around at the moment.&amp;nbsp; I will however keep your code in my back pocket for when this gets re-written with cleaner and more efficient code down the line...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Allison&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 May 2012 22:06:25 GMT</pubDate>
    <dc:creator>AllisonAnderson</dc:creator>
    <dc:date>2012-05-02T22:06:25Z</dc:date>
    <item>
      <title>Selecting PDF to view from datagrid result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751713#M69501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a datagrid that is returning the results from a spatial selection.&amp;nbsp; One of the fields contains the names of pdfs that I would like to have launch when clicked.&amp;nbsp; I've created a formatter for this field, so the user does not see the name - it's just a button.&amp;nbsp; If there is just one pdf listed in the attribute, I'm good.&amp;nbsp; But there are some features that have multiple pdfs and the user would pick which one they want to open. They are delimited by semicolons now in the attribute field.&amp;nbsp; I'm trying to figure out the best option for providing this functionality.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is it possible to create a dropdown list of all the pdfs and the one selected would launch?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or do I create a dialog box that would have links to each pdf?&amp;nbsp; I'm guessing I would need to parse out the individual pdf names into an array. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm new to all this programming stuff and am hacking together samples to make this work.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 May 2012 17:19:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751713#M69501</guid>
      <dc:creator>AllisonAnderson</dc:creator>
      <dc:date>2012-05-01T17:19:38Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting PDF to view from datagrid result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751714#M69502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is a little messy, but it works and should serve as an example as to how you could make this work.&amp;nbsp; I use JQuery, so hopefully that isn't an issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;During the initialization:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
map.graphics.enableMouseEvents();
dojo.connect(map.graphics, "onClick", function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.infoWindow.setContent("&amp;lt;span id='spanSelectPDF'&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;lt;input type='button' value='Open PDF' onclick='openPDF();' /&amp;gt;&amp;lt;/span&amp;gt;");
&amp;nbsp;&amp;nbsp;&amp;nbsp; var URLs = evt.graphic.attributes.PDFs.split(";"); // Assumes attribute's name is 'PDFs'
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (URLs.length &amp;gt; 1) { // More than 1 pdf, so use a select list...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var selectList = $("&amp;lt;select id='selectPDF' /&amp;gt;");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectList.append($("&amp;lt;option selected='selected'&amp;gt;Select PDF&amp;lt;/option&amp;gt;"));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; URLs.length; i++) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var url = URLs&lt;I&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectList.append($("&amp;lt;option value='" + url + "'&amp;gt;" + url + "&amp;lt;/option&amp;gt;"));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $("#spanSelectPDF").append(selectList);
&amp;nbsp;&amp;nbsp;&amp;nbsp; } else { // One (or fewer) pdfs, just put the URL in the span to display
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $("#spanSelectPDF").html(URLs[0]);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
});&lt;/I&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then the code for "openPDF()":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function openPDF() {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var url;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ($("#selectPDF").length &amp;gt; 0) // Check if the select list exists
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = $("#selectPDF").find("option:selected").val(); // get the value of the selected option
&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url = $("#spanSelectPDF").html(); // otherwise use the html we stuck in the span as the link
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (url != "") // Check the url has a value, as our default option has no value (requires that the user make a selection)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.open(url); // Open the link
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 07:55:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751714#M69502</guid>
      <dc:creator>TomJacoby</dc:creator>
      <dc:date>2021-12-12T07:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting PDF to view from datagrid result</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751715#M69503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Tom, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks much for the response.&amp;nbsp; For the time being, I decided to keep it simple and create multiple features for each record.&amp;nbsp; Basically I had multi-part features that were causing me confusion with the programming.&amp;nbsp; My next step is to create a button that will launch the raster, so keeping it simple will help with that too.&amp;nbsp;&amp;nbsp; Just a bit easier for me to wrap my mind around at the moment.&amp;nbsp; I will however keep your code in my back pocket for when this gets re-written with cleaner and more efficient code down the line...&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Allison&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2012 22:06:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/selecting-pdf-to-view-from-datagrid-result/m-p/751715#M69503</guid>
      <dc:creator>AllisonAnderson</dc:creator>
      <dc:date>2012-05-02T22:06:25Z</dc:date>
    </item>
  </channel>
</rss>

