<?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: add attribute to Graphic attributes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235701#M21966</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;What do you mean by "attribute"?&lt;/P&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#attr"&gt;attr(name, value) method&lt;/A&gt; adds an attribute to the DOM node of the graphic, not to the graphic feature.&lt;/P&gt;&lt;P&gt;So setting feature.attr('something', 123) will result in the graphic dom node to be:&lt;/P&gt;&lt;P&gt;&amp;lt;path something="123" ...&amp;gt;&amp;lt;/path&amp;gt;&lt;/P&gt;&lt;P&gt;(although I am not sure what types of elements graphics are).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to add an attribute to the graphic feature, in the sense of adding a new field, use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#setattributes"&gt;setAttributes&lt;/A&gt; method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Nov 2015 23:34:44 GMT</pubDate>
    <dc:creator>FilipKrál</dc:creator>
    <dc:date>2015-11-18T23:34:44Z</dc:date>
    <item>
      <title>add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235698#M21963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#attr" title="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#attr" rel="nofollow noopener noreferrer" target="_blank"&gt;Graphic | API Reference | ArcGIS API for JavaScript&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var feature = new Graphic(results&lt;I&gt;, symbol, inPoints&lt;I&gt;.attributes);&lt;/I&gt;&lt;/I&gt;
feature.attr("new_att", "new_value");&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to add an attribute to the existing attributes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this not the intended syntax or use of the method?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:53:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235698#M21963</guid>
      <dc:creator>DaveOrlando</dc:creator>
      <dc:date>2021-12-11T11:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235699#M21964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dave,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Is the results array that you have an array of geometries or graphics? That is the only thing I can see in your code that leads to questioning.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 23:20:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235699#M21964</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-11-18T23:20:25Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235700#M21965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the 'results' are from a geometryService.intersect so just geometries. The 'inPoints' are the original graphics which I use to marry the attributes back to the results&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 23:34:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235700#M21965</guid>
      <dc:creator>DaveOrlando</dc:creator>
      <dc:date>2015-11-18T23:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235701#M21966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;What do you mean by "attribute"?&lt;/P&gt;&lt;P&gt;The &lt;A href="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#attr"&gt;attr(name, value) method&lt;/A&gt; adds an attribute to the DOM node of the graphic, not to the graphic feature.&lt;/P&gt;&lt;P&gt;So setting feature.attr('something', 123) will result in the graphic dom node to be:&lt;/P&gt;&lt;P&gt;&amp;lt;path something="123" ...&amp;gt;&amp;lt;/path&amp;gt;&lt;/P&gt;&lt;P&gt;(although I am not sure what types of elements graphics are).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In order to add an attribute to the graphic feature, in the sense of adding a new field, use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/graphic-amd.html#setattributes"&gt;setAttributes&lt;/A&gt; method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 23:34:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235701#M21966</guid>
      <dc:creator>FilipKrál</dc:creator>
      <dc:date>2015-11-18T23:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235702#M21967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, I was trying to add to an existing attribute stack. I got it working with this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;atts = inPoints&lt;I&gt;.attributes;&lt;/I&gt;
atts["new_att"] = "new_value";
var feature = new Graphic(results&lt;I&gt;, symbol);&lt;/I&gt;
feature.setAttributes(atts);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:53:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235702#M21967</guid>
      <dc:creator>DaveOrlando</dc:creator>
      <dc:date>2021-12-11T11:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235703#M21968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or... back to my original code at top, I just realized you can add a new attribute directly using...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var feature = new Graphic(results&lt;I&gt;, symbol, inPoints&lt;I&gt;.attributes);&lt;/I&gt;&lt;/I&gt;
feature.attributes["new_att"] = "new_value";&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:53:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235703#M21968</guid>
      <dc:creator>DaveOrlando</dc:creator>
      <dc:date>2021-12-11T11:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: add attribute to Graphic attributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235704#M21969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you have real working demo ? I trying &amp;nbsp;a lot of difference examples no one doesn't work for me (&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 13:34:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/add-attribute-to-graphic-attributes/m-p/235704#M21969</guid>
      <dc:creator>AlexOliinyk</dc:creator>
      <dc:date>2017-05-16T13:34:20Z</dc:date>
    </item>
  </channel>
</rss>

