<?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: process JSON data to html table and display in pop-up in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803103#M5453</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever get this working? Since the default popup configuration for AGO does not&amp;nbsp;return 1:M related data. I am looking at direct querying my rest endpoint returning JSON data and passing into the popup. I want to return multiple related records in the popup for a feature class(1) that has documents(M) presented as hyperlinks. I would like to implement in a WAB application, but not real sure on how to do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 09 Aug 2018 16:09:16 GMT</pubDate>
    <dc:creator>MattEitrem</dc:creator>
    <dc:date>2018-08-09T16:09:16Z</dc:date>
    <item>
      <title>process JSON data to html table and display in pop-up</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803100#M5450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to include a function in a popup that process JSON data and display them in HTML pop-up?&lt;/P&gt;&lt;P&gt;I have the code that process the JSON and display in HTML table. I don't know how to get this working in pop-up inside the webapp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additional info about what I'm trying to do:&lt;/P&gt;&lt;P&gt;I'm trying to integerate our record managment system with Webapp. So I would like to be able to send a request to&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I’m trying to link documents (PDF, Word, etc. ) from our record management system to feature classes and have access to them through web applications. Each documents in record management system has GIS_ID which I’m using to link to each feature in my GIS layers. I have established a code to be able to process the JSON results which is created from our record management system. What I would like to do is to have the results to show up as a popup in my web application.&lt;BR /&gt;I have attached my HTML and JavaScript Code that process the JSON results received from our record management system and display them in HTML table.&amp;nbsp;I have attached some screenshots. and here is my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt; &amp;lt;head&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt; Json to table using Ajax Jquery getJSON&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;script src="&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/code.jquery.com/jquery-latest.js" rel="nofollow" target="_blank"&gt;http://code.jquery.com/jquery-latest.js&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;script src= "&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js" rel="nofollow" target="_blank"&gt;https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="nofollow" target="_blank"&gt;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css&lt;/A&gt;&lt;SPAN&gt;" /&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;script src="&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" rel="nofollow" target="_blank"&gt;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;/head&amp;gt;&lt;BR /&gt; &amp;lt;body&amp;gt;&lt;BR /&gt; &amp;lt;div class="container"&amp;gt;&lt;BR /&gt; &amp;lt;div class="table-responsive"&amp;gt;&lt;BR /&gt; &amp;lt;h1&amp;gt; Record Drawings&amp;lt;/h1&amp;gt;&lt;BR /&gt; &amp;lt;br /&amp;gt;&lt;BR /&gt; &amp;lt;table class="table table-bordered table-striped" id="drawing_table"&amp;gt;&lt;BR /&gt; &amp;lt;tr&amp;gt;&lt;BR /&gt; &amp;lt;th&amp;gt;RecordNumber&amp;lt;/th&amp;gt;&lt;BR /&gt; &amp;lt;th&amp;gt;RecordTitle&amp;lt;/th&amp;gt;&lt;BR /&gt; &amp;lt;th&amp;gt;Uri&amp;lt;/th&amp;gt;&lt;BR /&gt; &lt;BR /&gt; &amp;lt;/tr&amp;gt;&lt;BR /&gt; &amp;lt;/table&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;BR /&gt; &lt;BR /&gt; &amp;lt;/body&amp;gt;&lt;BR /&gt; &lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;$(document).ready(function(){&lt;BR /&gt;&lt;SPAN&gt; $.getJSON("&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/HPRMServiceAPI/Record?q=GISID:*" rel="nofollow" target="_blank"&gt;http://HPRMServiceAPI/Record?q=GISID:*&lt;/A&gt;&lt;SPAN&gt;{GIS_ID}*&amp;amp;format=json&amp;amp;properties=number,title",&lt;/SPAN&gt;&lt;BR /&gt;function(data){&lt;/P&gt;&lt;P&gt;var drawing_data ='';&lt;BR /&gt; $.each(data['Results'], function(key, value){&lt;BR /&gt; drawing_data += '&amp;lt;tr&amp;gt;';&lt;BR /&gt; drawing_data += '&amp;lt;td&amp;gt;' +value.RecordNumber.Value+'&amp;lt;/td&amp;gt;';&lt;BR /&gt;&lt;SPAN&gt; drawing_data += '&amp;lt;td&amp;gt;&amp;lt;a href="&lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.esri.com/vandocsweb.vancouver.ca/HPRMServiceAPI/Record" rel="nofollow" target="_blank"&gt;http://HPRMServiceAPI/Record/&lt;/A&gt;&lt;SPAN&gt;' + value.Uri + '/file/document" target="_blank"&amp;gt;' + value.RecordTitle.Value + '&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;';&lt;/SPAN&gt;&lt;BR /&gt; drawing_data += '&amp;lt;td&amp;gt;' +value.Uri+'&amp;lt;/td&amp;gt;';&lt;BR /&gt; drawing_data += '&amp;lt;tr&amp;gt;';&lt;BR /&gt; });&lt;BR /&gt; $('#drawing_table').append(drawing_data);&lt;BR /&gt; });&lt;BR /&gt;});&lt;BR /&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 May 2018 20:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803100#M5450</guid>
      <dc:creator>MehranMalek</dc:creator>
      <dc:date>2018-05-02T20:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: process JSON data to html table and display in pop-up</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803101#M5451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can create a listener for when features are selected as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this.own(on(this.map.infoWindow, 'selection-change', lang.hitch(this, this._onSelectionChange)));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your "_onSelectionChange" function you can check the details of the feature and do your query. I have something similar set up to query related records out of an a-spatial database, then add them to the popup under the feature details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;_onSelectionChange: function (selectedFeature) {&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;console.log(selectedFeature);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//use the selected feature to run your query.&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; //nl&amp;nbsp;should return the main section of your popup.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var nl = query('.mainSection');&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; if(nl.length &amp;gt; 0){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//Add your table details in to this div.&lt;/P&gt;&lt;P&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;var div = domConstruct.toDom(drawing_data);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&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;//Then append it to the popup&lt;/P&gt;&lt;P&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;nl[0].appendChild(div);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the above you'll need the following.&lt;/P&gt;&lt;P&gt;query = dojo/query&lt;/P&gt;&lt;P&gt;domConstruct = dojo/dom-construct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above may not be perfect as its from my web appbuilder application, but it should help you along the way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 06 May 2018 08:58:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803101#M5451</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2018-05-06T08:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: process JSON data to html table and display in pop-up</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803102#M5452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much Grant!&amp;nbsp; I'll try and see if I can get mine working &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2018 18:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803102#M5452</guid>
      <dc:creator>MehranMalek</dc:creator>
      <dc:date>2018-05-18T18:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: process JSON data to html table and display in pop-up</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803103#M5453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you ever get this working? Since the default popup configuration for AGO does not&amp;nbsp;return 1:M related data. I am looking at direct querying my rest endpoint returning JSON data and passing into the popup. I want to return multiple related records in the popup for a feature class(1) that has documents(M) presented as hyperlinks. I would like to implement in a WAB application, but not real sure on how to do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Aug 2018 16:09:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803103#M5453</guid>
      <dc:creator>MattEitrem</dc:creator>
      <dc:date>2018-08-09T16:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: process JSON data to html table and display in pop-up</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803104#M5454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Matt,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See the attached code, I use this in a custom theme based on the foldable theme. There is a custom widget in there that handles the results from a query and builds a table based on that and then inserts in to the popup. (There is also code in there to make the popup moveable). While this works ok in a standard popup, it works really well with &lt;A href="https://community.esri.com/migrated-users/3101" target="_blank"&gt;Robert Scheitlin, GISP&lt;/A&gt;&amp;nbsp; popup side panel.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you reference the popuphandler.js in your controller widget,&amp;nbsp; and then use it in the post create, like below. (You will need to have the code in the same location as the Widget.js for your theme's controller).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image" height="165" src="https://community.esri.com/legacyfs/online/418401_Capture.PNG" width="789" /&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;this.popupHandler = new PopupHandler({
 &amp;nbsp;&amp;nbsp;&amp;nbsp;map: this.map,
 &amp;nbsp;&amp;nbsp;&amp;nbsp;controller: this,
 });&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Grant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:56:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/process-json-data-to-html-table-and-display-in-pop/m-p/803104#M5454</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2021-12-12T16:56:07Z</dc:date>
    </item>
  </channel>
</rss>

