AnsweredAssumed Answered

TOC coding problem

Question asked by Muqitzoarder111 on Feb 15, 2016
Latest reply on Feb 15, 2016 by Muqitzoarder111

Dear all, please have a look on my TOC (table of content) coding. I have placed the agsjs folder in my web root directory and the path is all rgiht i think. But I am not getting any result.

 

Script:

 

<!DOCTYPE html>

<html>

 

<head>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <meta http-equiv="X-UA-Compatible" content="IE=Edge" />

        <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">

        <title>Dresden Building Web Map</title>

        <link rel="stylesheet" href="http://js.arcgis.com/3.15/esri/css/esri.css">

        <link rel="stylesheet" href="https://js.arcgis.com/3.15/dijit/themes/claro/claro.css">

   <link rel="stylesheet" type="text/css" href="./agsjs/css/agsjs.css" />

      <link rel="stylesheet"  href="./css/toc.css">

        <script type="text/javascript">

        var dojoConfig =

        {paths: {agsjs: location.pathname.replace(/\/[^/]+$/, '') + '/agsjs' }};

        </script>

    <script src="http://js.arcgis.com/3.15/"> </script>

    <script>

      var map, toc, dynaLayer1;

 

      require(["dojo/_base/connect",

             "dojo/dom", "dojo/parser","dojo/on", "dojo/_base/Color",

            

             "esri/map",

             "esri/geometry/Extent",

             "esri/layers/FeatureLayer",

             "esri/layers/ArcGISTiledMapServiceLayer",

             "esri/layers/ArcGISDynamicMapServiceLayer",

            

             "esri/symbols/SimpleFillSymbol",

             "esri/renderers/ClassBreaksRenderer",

            

             "agsjs/dijit/TOC",

            

             "dijit/layout/BorderContainer",

             "dijit/layout/ContentPane",

             "dojo/fx", "dojo/domReady!"], function(connect,  dom, parser, on,Color,

             Map, Extent, FeatureLayer, ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer,

             SimpleFillSymbol,ClassBreaksRenderer,

             TOC){

           

              // call the parser to create the dijit layout dijits

              parser.parse(); // note djConfig.parseOnLoad = false;

            

              map = new Map("map", {

                basemap: "topo",

                center: [-85.75, 38.25],

                zoom: 13

              });

             

              dynaLayer1 = new ArcGISDynamicMapServiceLayer("http://192.168.224.16:6080/arcgis/rest/services/Dresden/MapServer", {

                opacity: 0.8

              });

            map.on('layers-add-result', function(evt){

            toc = new TOC({

                    map: map,

                    layerInfos: [{

                      layer: dynaLayer1,

                      title: "DynamicMapServiceLayer1"

                      //collapsed: false, // whether this root layer should be collapsed initially, default false.

                      //slider: false // whether to display a transparency slider.

                    }]

                  }, 'tocDiv');

                  toc.startup();

                  map.addLayers([dynaLayer1]);

            });

     

  </head>

   <body class="claro">

        <div id="content" data-dojo-type="dijit/layout/BorderContainer" design="headline" gutters="true" style="width: 100%; height: 100%; margin: 0;">

           

            <div data-dojo-type="dijit/layout/ContentPane" id="leftPane" region="left" splitter="true">

                <div id="tocDiv">

                </div>

            </div>

            <div id="map" data-dojo-type="dijit/layout/ContentPane" region="center">

            </div>

        </div>

         

       

    </body>

</html>

 

 

 

Thanks

Outcomes