Problem with a agsjs TOC

807
2
Jump to solution
05-21-2013 09:54 AM
Charlesshultz
New Contributor III
This is a great widget but for some reason I am having issues getting it to display the symbols and (+/-) buttons.

When I firebug the error for symbols it says to:
Please verify the Service URL specified is correct :- http://servername:6080/arcgis/services/Parcels/MapServer
What's odd is that I never specified
       http://servername:6080/arcgis/services/Parcels/MapServer
The code for that layer is:
    
 var Parcels_Layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://servername:6080/arcgis/rest/services/Parcels/MapServer", {         id: 'Parcels_Layer'     });

The "/rest/" seems to be getting lost somehow and it can not find it.

I have no idea about the (+/-) buttons not showing up.

Here is my code... Any help would be great because I would love to use this in my applications...

<link rel="stylesheet" type="text/css" href="CSS/Style.css">      <link rel="stylesheet" type="text/css" href="CSS/Imported_CSS.css">      <link rel="stylesheet" type="text/css" href="agsjs/css/TOC.css"/>  <script type="text/javascript">      var dojoConfig = {         parseOnLoad: true,         packages: [           { "name": "esriTemplate", "location": location.pathname.replace(/\/[^/]+$/, '') },          {//name: "agsjs",               //"location": location.pathname.replace(/\/[^/]+$/,'')+'/agsjs'               "name": "agsjs",               "location": 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.04/xbuild/agsjs'           }         ]     };     </script>               <script type="text/javascript" src="//serverapi.arcgisonline.com/jsapi/arcgis/3.1"></script>




///I Get an error here Error: Tried to register widget with id==tocDiv3 but that id is already registered
The container:
      <div id ="LeftPane" dojotype="dijit.layout.ContentPane" region="left" style=" width:250px">            <div id ="tocDiv3" >            </div>      </div>


JS file:
   var Parcels_Layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://servername:6080/arcgis/rest/services/Parcels/MapServer", {         id: 'Parcels_Layer'     });         var Base_Layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://servername:6080/arcgis/rest/services/Basedata/MapServer", {         id: 'Base_Layer'     });    ///I Get an error here Error: Tried to register widget with id==tocDiv3 but that id is already registered ///This was supposed to get rid of this error but it does not?   var TOCDiv = dijit.byId('tocDiv3');     if (TOCDiv) {         TOCDiv.destroyRecursive(true);     }     dojo.connect(map, 'onLayersAddResult', function (results) {         var toc = new agsjs.dijit.TOC({             map: map,             style: "inline",             layerInfos: [{layer: Parcels_Layer,                 title: "Parcels",                 slider: true                 },                 {                     layer: Base_Layer,                     title: "Basemap Layers",                     slider: true                                                }                                 ]         }, 'tocDiv3');         toc.startup();     });
0 Kudos
1 Solution

Accepted Solutions
Charlesshultz
New Contributor III
I just switched to another solution for the TOC.

View solution in original post

0 Kudos
2 Replies
Charlesshultz
New Contributor III
I just switched to another solution for the TOC.
0 Kudos
WilliamBailey
New Contributor II
I just switched to another solution for the TOC.


Care to share the other solution... seems kinda strange no TOC was included with API
I am not having luck with the agsjs solution either (think it's for 10.0. not 10.1)

p.s. js 3.5 ArcGIS 10.1
0 Kudos