here is my code to display toc.Its displaying dynamic layers but why its not displaying feature layers.

<!DOCTYPE html>  
    <title>Create a Map</title>  
    <meta http-equiv="content-type" content="text/html; charset=utf-8">  
    <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no">  
    <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/soria/soria.css">  
    <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css">  
    <!--<link href="agsjs/dijit/css/TOC.css" rel="stylesheet" type="text/css" />-->  
    <link rel="stylesheet" type="text/css" href="http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/latest/build/agsjs/css/agsjs.css" />  
        html, body, #mapDiv {  
            padding: 0;  
            margin: 0;  
            height: 100%;  
            width: 100%;  
            overflow: hidden;  

        #tocDiv {  
            z-index: 50;  
            position: absolute;  
            top: 0%;  
            left: 0%;  
            width: 300px;  
            height: auto;  
            background-color: White;  

        #scaleDiv .agsjsTOCOutOfScale {  
            display: none;  

        #divDialogProcess {  
            z-index: 50;  
            position: absolute;  
            right: 0%;  
            top: 0%;  
            background-color: White;  
        var dojoConfig = {  
            packages: [{  
                name: "agsjs",  
                "location": 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/latest/build/agsjs' // for xdomain load  

    <script src="http://js.arcgis.com/3.11/"></script>  
        var map, tiled, pointFeatureLayer, operationalLayer;  
        require(["esri/map", "esri/config",  
                 "dojo/domReady!"], function (Map, esriConfig, Extent, ArcGISDynamicMapServiceLayer, FeatureLayer, ClassBreaksRenderer, SimpleFillSymbol, GeometryService, dom, domGeom, coreFx, on, parser, Color, TOC  
        ) {  

                map = new Map("mapDiv", {
                 center: [77.2, 14],
                 zoom: 7,
                 basemap: "streets",
                 slider: false,


                     operationalLayer = new ArcGISDynamicMapServiceLayer("", { id: "Operational", opacity: 0.5 });  

                     pointFeatureLayer = new FeatureLayer("", { id: "Points" });  

                     map.addLayers([operationalLayer, pointFeatureLayer]);  

                     // Add Table of Contents Start  
                     map.on('layers-add-result', function (evt) {  
                         try {  
                             var toc = new TOC({  
                                 map: map,  
                                 layerInfos: [{  
                                     layer: pointFeatureLayer,  
                                     title: "My Feature"  
                                 }, {  
                                     layer: operationalLayer,  
                                     title: "Dynamic Map"  
                             }, "tocDiv");  

                             toc.on("load", function () {  
                                 console.log("TOC loaded");  
                         catch (e) { console.error(e.message); }  

<body class="soria">  
    <div id="mapDiv">  
        <div id="tocDiv"></div>  

Can any one tell whats wrong in the above code?

  • Please take the tour which gives an overview of how this site works and leads into a more detailed help center.
    – PolyGeo
    Jan 13 '16 at 7:34

A FeatureLayer shows a single layer in a service, which you have to include in its constructor. You have to specify the GridPoint layer (0)

pointFeatureLayer = new FeatureLayer("", { id: "Points" });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.