AnsweredAssumed Answered

TOC not loading legend

Question asked by rhyck.m on Jan 22, 2016
Latest reply on Jan 22, 2016 by rhyck.m

The toc widget is acting strange. it is not loading. sometimes after multiple refresh, it loads fine.

noLegendToc.PNG

here is the error message I get:

errorToc.PNG

 

here is my code

//define Proxy
    esriConfig.defaults.io.proxyUrl = "proxy.ashx";
    esriConfig.defaults.io.alwaysUseProxy = false;
     //============================
    map.on("load", function (evt) {
        mapReady();
       getLayers();
    });

  //LEGEND CHECKBOX
    function getLayers() {      
            map.on("layer-add-result", function (evt) {
                // console.log(evt);
                try {
                    toc = new TOC({
                        map: map,
                        layerInfos: [{
                            layer: layerName,
                            title: "Layers",
                            collapsed: false,
                            slider: true
                        }]
                    }, 'legendDiv');
                    toc.startup();
                }
                catch (ex) {
                    // console(ex.toString());
                }
            }) 
        }

 

I am not sure why the toc is not loading correctly. Any ideas?

The error message is :

message: "Unable to load http://www.arcgis.com/sharing/tools/legend?soapUrl=http

Outcomes