<?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 Extending esri/dijit/Popup in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126891#M11754</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm looking to extend Popup to handle my custom results.&amp;nbsp; The results are not in the format expected by the Popup so the Popup will error out when I try to use them.&amp;nbsp; I've been playing around a little bit with this and can get fairly close except there are a lot of methods on popup that still error out.&amp;nbsp; It is very difficult for me to just overwrite these methods because I like the functionality of the Popup which is why I want to extend it.&amp;nbsp; This was supposed to save me a lot of time by not having to write my own, but it doesn't look that way now.&amp;nbsp; Anyway, the main idea is for the new Popup to behave exactly as the original, only it can accept a different type of results for .setFeatures().&amp;nbsp; I could pull all of the functionality I need out and just use .show() and .setContent() but I really like the paging controls, etc and so was hoping to use those.&amp;nbsp; My results are actually an array of objects from a database query.&amp;nbsp; Each record has a "features" property that contains the features associated with it.&amp;nbsp; I do it this way because one record can have multiple features and I want to step through the records, not the features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any ideas or suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of what my results look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

[
&amp;nbsp; {id:1,
&amp;nbsp;&amp;nbsp;&amp;nbsp; field1:"somevalue",
&amp;nbsp;&amp;nbsp;&amp;nbsp; field2:"somevalue2",
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...,
&amp;nbsp;&amp;nbsp;&amp;nbsp; features:[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {id:1,geometry:{}},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {id:2,geometry:{}}
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]
&amp;nbsp;&amp;nbsp; }
]

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2013 16:06:18 GMT</pubDate>
    <dc:creator>GeorgeSimpson</dc:creator>
    <dc:date>2013-10-04T16:06:18Z</dc:date>
    <item>
      <title>Extending esri/dijit/Popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126891#M11754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm looking to extend Popup to handle my custom results.&amp;nbsp; The results are not in the format expected by the Popup so the Popup will error out when I try to use them.&amp;nbsp; I've been playing around a little bit with this and can get fairly close except there are a lot of methods on popup that still error out.&amp;nbsp; It is very difficult for me to just overwrite these methods because I like the functionality of the Popup which is why I want to extend it.&amp;nbsp; This was supposed to save me a lot of time by not having to write my own, but it doesn't look that way now.&amp;nbsp; Anyway, the main idea is for the new Popup to behave exactly as the original, only it can accept a different type of results for .setFeatures().&amp;nbsp; I could pull all of the functionality I need out and just use .show() and .setContent() but I really like the paging controls, etc and so was hoping to use those.&amp;nbsp; My results are actually an array of objects from a database query.&amp;nbsp; Each record has a "features" property that contains the features associated with it.&amp;nbsp; I do it this way because one record can have multiple features and I want to step through the records, not the features.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Anyone have any ideas or suggestions?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example of what my results look like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

[
&amp;nbsp; {id:1,
&amp;nbsp;&amp;nbsp;&amp;nbsp; field1:"somevalue",
&amp;nbsp;&amp;nbsp;&amp;nbsp; field2:"somevalue2",
&amp;nbsp;&amp;nbsp;&amp;nbsp; ...,
&amp;nbsp;&amp;nbsp;&amp;nbsp; features:[
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {id:1,geometry:{}},
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {id:2,geometry:{}}
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]
&amp;nbsp;&amp;nbsp; }
]

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 16:06:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126891#M11754</guid>
      <dc:creator>GeorgeSimpson</dc:creator>
      <dc:date>2013-10-04T16:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Extending esri/dijit/Popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126892#M11755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Why not create an array of features (graphics) and use setFeatures as normal?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The Graphic class allows you to transform data in any format to an object the api understands.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I use php and mysql to store records which are primarily created and edited through web forms, and viewed in reports outside the mapping application. But they have a geographic component, mostly point geometry (x/y). I use both user based queries and pseudo-feature layers (a graphics layer wired up for onPanEnd and onZoomEnd to request using map bounds). The records aren't returned in the same format as arcgis server returns them. So I create graphics with the results, and use them just like I would with ags results from query, identify, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As far as handling multiple features per record:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var features = [];
dojo.forEach(results), function (result) {
&amp;nbsp; dojo.forEach(result.features, function (feat) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = new esri.Graphic();
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setSymbol(SOME_SYMBOL);
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setGeometry(feat.geometry);
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setAttribures({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resultId: result.id,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureId: feat.id,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field1: result.field1,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; field2: result.field2
&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.setInfoTemplate(new esri.infoTemplate('My Features', '${*}');
&amp;nbsp;&amp;nbsp;&amp;nbsp; features.push(graphic);
&amp;nbsp; });
});
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:12:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126892#M11755</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2021-12-11T07:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Extending esri/dijit/Popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126893#M11756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I thought about that but was hoping to avoid paging through multiple features that represented a single record.&amp;nbsp; I really want to be able to show the attributes and all of the associated features at one time.&amp;nbsp; This way the user would see the business data in the popup and the features for that record would be highlighted on the map.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 19:22:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126893#M11756</guid>
      <dc:creator>GeorgeSimpson</dc:creator>
      <dc:date>2013-10-04T19:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extending esri/dijit/Popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126894#M11757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If they are points, why not esri.geometry.Multipoint?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If not, I would assume there is a way to create multi-part graphics by merging geometries. I've never done that creating custom graphics, but server returns multi-part features, e.g. a parcel of land with a right-of-way through it, as a single geometry/graphic.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 19:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126894#M11757</guid>
      <dc:creator>BenFousek</dc:creator>
      <dc:date>2013-10-04T19:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extending esri/dijit/Popup</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126895#M11758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Unfortunately, they can be points,lines and/or polygons.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That sounds like a good approach.&amp;nbsp; I'm going to see if that's doable&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 19:50:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/extending-esri-dijit-popup/m-p/126895#M11758</guid>
      <dc:creator>GeorgeSimpson</dc:creator>
      <dc:date>2013-10-04T19:50:58Z</dc:date>
    </item>
  </channel>
</rss>

