<?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: AGS JavaScript Api Combined TOC/Legend Contol in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690270#M64227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to make the above legend/TOC work with a map that is using JSAPI 3.3? I have everything else I need working but it uses the JSAPI 3.3. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Court&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Mar 2013 15:10:53 GMT</pubDate>
    <dc:creator>CourtneyRiggs</dc:creator>
    <dc:date>2013-03-21T15:10:53Z</dc:date>
    <item>
      <title>AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690266#M64223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Has anyone seen or been working on a Combined TOC/Legend Contol for the AGS JavaScript Api? something similar to what is available in the Web Adf TOC?&amp;nbsp; I have seen lots of examples, discussion, etc. on a Legend control or TOC control seperately, but nothing combined where the TOC simply has the symbology within it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thx&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Simon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jun 2011 13:27:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690266#M64223</guid>
      <dc:creator>SimonFisher</dc:creator>
      <dc:date>2011-06-16T13:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690267#M64224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;try &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.arcgis.com/home/item.html?id=9c43bdf76a23452ba1d95684f7cd76d8"&gt;http://www.arcgis.com/home/item.html?id=9c43bdf76a23452ba1d95684f7cd76d8&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Aug 2011 15:17:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690267#M64224</guid>
      <dc:creator>NianweiLiu</dc:creator>
      <dc:date>2011-08-08T15:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690268#M64225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not available anymore? &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 00:27:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690268#M64225</guid>
      <dc:creator>AlexZhuk</dc:creator>
      <dc:date>2013-03-20T00:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690269#M64226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/examples/toc.html"&gt;http://gmaps-utility-gis.googlecode.com/svn-history/r354/trunk/agsjs/examples/toc.html&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;see this example&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Mar 2013 06:54:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690269#M64226</guid>
      <dc:creator>ManojrajTeli</dc:creator>
      <dc:date>2013-03-20T06:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690270#M64227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is it possible to make the above legend/TOC work with a map that is using JSAPI 3.3? I have everything else I need working but it uses the JSAPI 3.3. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Court&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 15:10:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690270#M64227</guid>
      <dc:creator>CourtneyRiggs</dc:creator>
      <dc:date>2013-03-21T15:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690271#M64228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is it possible to make the above legend/TOC work with a map that is using JSAPI 3.3? I have everything else I need working but it uses the JSAPI 3.3. &lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Court&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using the custom legend and it all works with the Javascript 3.3 API. I have not had any issues with it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just point all the stylesheet ref and js source files to the correct version.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that in my case I exported all the files for the TOC and added to my solution as requested by the client.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/soria/soria.css"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dojox/grid/resources/Grid.css"&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dojox/grid/resources/SoriaGrid.css"&amp;gt;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dojox/layout/resources/FloatingPane.css"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dojox/layout/resources/ResizeHandle.css"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css" /&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;link rel="stylesheet" href="css/defaultStyle.css"/&amp;gt;
&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;script&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dojoConfig = {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parseOnLoad: true,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; packages: [
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; { "name": "agsjs",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "location": location.pathname.replace(/\/[^/]+$/, "")+'/lib/agsjs/Build_2_04'
&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; };&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/script&amp;gt;
&amp;lt;script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3"&amp;gt;&amp;lt;/script&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:03:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690271#M64228</guid>
      <dc:creator>DianaBenedict</dc:creator>
      <dc:date>2021-12-12T05:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690272#M64229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Diana, thank you for that info, it has gotten me a bit further!! Unfortunately I am stuck again, but I think I know where.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have only been writing code for a couple weeks so all this is still very new and confusing to me, so thank you for any help!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have made sure all the links you listed are included and changed the script for var dojoConfig. I changed the path in the modulePaths to 2.04 because it looks like yours is referencing 2.4. Once I do that nothing works regardless of the version the API is set to. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you can point me in the right direction on how to fix this I would greatly appreciate it!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a link to the code I have (with the packages and JSAPI3.3: &lt;/SPAN&gt;&lt;A href="http://mas-gis.info/cariggs/All_ToggleLegend4.html"&gt;http://mas-gis.info/cariggs/All_ToggleLegend4.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Court&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Mar 2013 19:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690272#M64229</guid>
      <dc:creator>CourtneyRiggs</dc:creator>
      <dc:date>2013-03-21T19:50:13Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690273#M64230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Court&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1) I forgot to remove the reference to my css file called defaultStyle.css so please make sure to remove that reference&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) I decided to use the esri Soria Stylesheets but there are others that they do have that might also work for you. So in my case, I referenced the soria.css style&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/soria/soria.css" rel="nofollow noopener noreferrer" target="_blank"&gt;http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/soria/soria.css&lt;/A&gt;&lt;SPAN&gt;"/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3) Some people have indicated that you should make sure to keep the link to the esri.css stylesheet so that your UI renders correctly &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css" rel="nofollow noopener noreferrer" target="_blank"&gt;http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;" /&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4) All the other links to external styles are based on other DOJO widgets that use such as data grids, floating panels, etc... So I had to go ahead and add them in. However, you may not need them in your applicaiton.&amp;nbsp; (Try to keep it light if you can).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;5) The source code and reference to the most current version of the agsjs library can be found here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;You might want to look at the following samples for additional help&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/examples/toc.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/examples/toc.html&lt;/A&gt;&lt;SPAN&gt; (this sample still references old stuff)&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://maps.charlottenc.gov/templates/basicviewer/?webmap=460c54f38736428fa9c3429071be07b8" rel="nofollow noopener noreferrer" target="_blank"&gt;http://maps.charlottenc.gov/templates/basicviewer/?webmap=460c54f38736428fa9c3429071be07b8&lt;/A&gt;&lt;SPAN&gt; (this sample is like mine, it reference the library that is copied locally&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that in the toc.html example (right click on the page --&amp;gt; view source) indicates that you can use the following for the location property which is the commented out section of the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.02/xbuild/agsjs" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.02/xbuild/agsjs&lt;/A&gt;&lt;SPAN&gt;' // for xdomain load&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;...but test this out for sure cause it looks like the code has not been updated, you should be able to see the xbuild code at the following instead&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/xbuild/agsjs" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/xbuild/agsjs&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;ALSO,&amp;nbsp; DO NOT use the djConfig but rather dojoConfig&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;6) Make sure to include your dojo.require statements to make it all work&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;7) set up your layerInfo object for each layer that you want to be in the legend. Refer to the documentation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/docs/toc/reference.html#TOCLayerInfo" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/docs/toc/reference.html#TOCLayerInfo&lt;/A&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; create the legend&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so your code might look something like this ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

//changes to the djC
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var dojoConfig = {
&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; parseOnLoad: true,
&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; packages: [{
&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;&amp;nbsp; "name": "agsjs",
&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;&amp;nbsp; "location": 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/xbuild/agsjs' 
&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };

//add the require statements in the section of the JS script/file
dojo.require("dojo.fx");
dojo.require("agsjs.dijit.TOC");

//create code to set up your legenLayerInfos
//..this part is up to you on how you do this
var layerInfos = [];
//TODO: you need to add an array that looks something like this .. note this is only an example of one layerInfo object that the legend expects
var layerInfo = {
&amp;nbsp;&amp;nbsp; "layer": fcMapLayer.layerObject,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "title": mapLayer.title,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "defaultSymbol": false
};
layerInfos.push(layerInfo);

//create the legend object
var legendDijit = new agsjs.dijit.TOC({//NL: new esri.dijit.Legend({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map: map,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerInfos: layerInfo
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, dojo.create('div'));
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:03:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690273#M64230</guid>
      <dc:creator>DianaBenedict</dc:creator>
      <dc:date>2021-12-12T05:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690274#M64231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Also just a tip.. you can put multiple instances of the AGSJS TOC object (the widget) in your site. For example, I have several AGSJS TOC widgets, each in their own Accordion Panes.&amp;nbsp; (Read more on Accordions and Border Container layout on in Dojo's docs at the Dojo website&amp;nbsp; at &lt;/SPAN&gt;&lt;A href="http://dojotoolkit.org/reference-guide/1.8/dijit/layout/BorderContainer.html"&gt;http://dojotoolkit.org/reference-guide/1.8/dijit/layout/BorderContainer.html&lt;/A&gt;&lt;SPAN&gt; ). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, it does the cascading levels only for dynamic layers, NOT feature layers! That is why we put a few AGSJS TOCs with Feature Layers into their own Accordions. However that'd be a cool update. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note that the coolest example is that the auther Nianwei integrated his widget into the ESRI Basic Viewer at &lt;/SPAN&gt;&lt;A href="http://maps.charlottenc.gov/templates/basicviewer/?webmap=460c54f38736428fa9c3429071be07b8"&gt;http://maps.charlottenc.gov/templates/basicviewer/?webmap=460c54f38736428fa9c3429071be07b8&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(Thread: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/75725-BasicViewer-with-TOC"&gt;http://forums.arcgis.com/threads/75725-BasicViewer-with-TOC&lt;/A&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'd love to see this just rolled into the API by default. It's a fantastic piece of work. Also, see his Google Maps widget, at his site above. I would encourage ESRI to consider integrating this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also Court consider reviewing Dojo's docs on using dojoConfig to use ESRI's server for the API but deploying this widget locally. &lt;/SPAN&gt;&lt;A href="http://dojotoolkit.org/documentation/tutorials/1.8/dojo_config/"&gt;http://dojotoolkit.org/documentation/tutorials/1.8/dojo_config/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this is enough to get you started and it helps. I just learned and implemented this same process last month. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Mar 2013 14:44:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690274#M64231</guid>
      <dc:creator>KevinMacLeod1</dc:creator>
      <dc:date>2013-03-22T14:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690275#M64232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, the TOC widget works well with map initial loading. But when I add a new map service to the map later, reset the TOC's layerInfos, and do toc.refresh(). The exisiting layers in the table of content gets doubled. Does anybody know why? Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Jun 2013 19:18:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690275#M64232</guid>
      <dc:creator>HelenZhou</dc:creator>
      <dc:date>2013-06-27T19:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690276#M64233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am fairly new to Javascript programing, and trying to incorporate @kmacleod's suggestion to use multiple instances of the TOC/Legend widget, in an accordion style presentation within my legend.&amp;nbsp; In my attempts to work through this, I am first trying to simply add each layer into the TOC widget (within the legend pane), while also incorporate the transparency slider.&amp;nbsp; Note that I am working from the ArcGIS Basic Viewer web application, which may be part of my issue.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code (below) works great for the first three layers, which are all tile services.&amp;nbsp; However, starting at layer 4, all remaining layers are Feature Services, and I keep getting errors that these layers are not being found, or not loaded.&amp;nbsp; If I call all layers (simply using layerInfos: layerInfo), then everything does get added to the legend (but no slider bars, of course, and then I can't split up what layers go into what accordion pane).&amp;nbsp;&amp;nbsp; Any suggestions for what I may be doing wrong would be greatly appreciated!!!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Arty&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var legendDijit = new agsjs.dijit.TOC({//NL: new esri.dijit.Legend({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map: map,&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerInfos: [{
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer: map.getLayer(map.layerIds[1]),
&amp;nbsp;&amp;nbsp;&amp;nbsp; slider: true
&amp;nbsp; }, {
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer: map.getLayer(map.layerIds[2]),
&amp;nbsp;&amp;nbsp;&amp;nbsp; slider: true
&amp;nbsp; }, {
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer: map.getLayer(map.layerIds[3]),
&amp;nbsp;&amp;nbsp;&amp;nbsp; slider: true
&amp;nbsp; }, {
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer: map.getLayer(map.layerIds[4]),
&amp;nbsp;&amp;nbsp;&amp;nbsp; slider: true&amp;nbsp; 
&amp;nbsp; }]
&amp;nbsp;&amp;nbsp;&amp;nbsp; }, dojo.create('div'));

&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.byId('legendPanel').appendChild(legendDijit.domNode);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 05:03:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690276#M64233</guid>
      <dc:creator>ArthurRodriguez</dc:creator>
      <dc:date>2021-12-12T05:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690277#M64234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an accordion legend here if you'd like to use it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://driskull.github.io/arcgis-dijit-layer-legend-js/"&gt;http://driskull.github.io/arcgis-dijit-layer-legend-js/&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://github.com/driskull/arcgis-dijit-layer-legend-js"&gt;https://github.com/driskull/arcgis-dijit-layer-legend-js&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2014 17:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690277#M64234</guid>
      <dc:creator>MattDriscoll</dc:creator>
      <dc:date>2014-01-06T17:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690278#M64235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you, Matt, I may use this to set up my accordion panes when I get to that point.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, I think my main issue is figuring out how to call individual layers within my map, which was set up through ArcGIS online.&amp;nbsp; The first three layers in my map are all tiled services, and seem to have easy to understand ID numbers: 1, 2, and 3.&amp;nbsp; I also can get the basemap added to my legend by using the ID 0 (zero).&amp;nbsp; After that, everything I try is coming up as undefined.&amp;nbsp; Any idea why this may be?&amp;nbsp; Are feature services ID numbers set up differently than other services?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let me know if this should be posted in another forum, or anything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Arty&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Jan 2014 18:11:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690278#M64235</guid>
      <dc:creator>ArthurRodriguez</dc:creator>
      <dc:date>2014-01-06T18:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: AGS JavaScript Api Combined TOC/Legend Contol</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690279#M64236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thank you, Matt, I may use this to set up my accordion panes when I get to that point.&lt;BR /&gt;&lt;BR /&gt;Currently, I think my main issue is figuring out how to call individual layers within my map, which was set up through ArcGIS online.&amp;nbsp; The first three layers in my map are all tiled services, and seem to have easy to understand ID numbers: 1, 2, and 3.&amp;nbsp; I also can get the basemap added to my legend by using the ID 0 (zero).&amp;nbsp; After that, everything I try is coming up as undefined.&amp;nbsp; Any idea why this may be?&amp;nbsp; Are feature services ID numbers set up differently than other services?&lt;BR /&gt;&lt;BR /&gt;Please let me know if this should be posted in another forum, or anything.&lt;BR /&gt;&lt;BR /&gt;Thanks again,&lt;BR /&gt;-Arty&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;HI, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Can anyone tell me, how to get the ArcGISDynamic MapService layer name from map.getLayer(map.LayerIds(1)) method.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Jan 2014 20:13:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/ags-javascript-api-combined-toc-legend-contol/m-p/690279#M64236</guid>
      <dc:creator>GaneshSolai_Sambandam</dc:creator>
      <dc:date>2014-01-25T20:13:44Z</dc:date>
    </item>
  </channel>
</rss>

