edibertoalves

TOC Widget - Slider is not working

Discussion created by edibertoalves on May 14, 2014
Latest reply on May 26, 2014 by gauri_d
Hi!

I am developing an application using the TOC Widget from this source:
http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/latest/docs/toc/examples.html

However, I'm not getting the slide tool to make transparency. On the moment that the user select the layer that desire to work and the layer is loaded.

Below the code snippet.

var dynaLayer1, dynaLayer2;
var toc, toogleLayer;

var dynaLayer1, dynaLayer2;
var toc, toogleLayer;

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!",
"dojo/dom-construct",
"dijit/registry"
],
function (connect, dom, parser, on, Color,
Map, Extent, FeatureLayer, ArcGISTiledMapServiceLayer, ArcGISDynamicMapServiceLayer,
SimpleFillSymbol, ClassBreaksRenderer,
TOC, domConstruct, registry) {
    
     parser.parse();

     var mapServer = dojo.byId('selEmpreendimento'); // options from select with url mapservers

     dynaLayer1 = new ArcGISDynamicMapServiceLayer(mapServer.value, {
         mode: FeatureLayer.MODE_ONDEMAND
     });

   

    map.on('LayersAddResult', function (evt) {

         toc = new agsjs.dijit.TOC({
             map: map,
             layerInfos: [
             //{
             //    layer: featLayer1,
             //    title: "Fotos",
             //    //collapsed: false, // whether this root layer should be collapsed initially, default false.
             //    slider: true // whether to display a transparency slider.
             //},
             {
                 layer: dynaLayer1,
                 title: dynaLayer1.layerInfos.name,
                 //collapsed: false, // whether this root layer should be collapsed initially, default false.
                 slider: true // whether to display a transparency slider.
             }]
         }, 'tocDiv');

         toc.startup();
         map.addLayer(dynaLayer1);
       
     });

     on(mapServer, 'change', function (evt) {
         dynaLayer2 = new ArcGISDynamicMapServiceLayer(mapServer.value, {
             mode: FeatureLayer.MODE_ONDEMAND
         });

         map.addLayer(dynaLayer2);

         toogleLayer = map.on('LayerAddResult', function (evt) {
             toc.layerInfos.splice(0, 1, {
                 layer: dynaLayer2,
                 title: dynaLayer2.layerInfos.name,
                 slider: true
                
             });
            
             toc.refresh();
             toogleLayer.remove();
            
            
         });


     });

});

What I am make wrong?

Thanks

Outcomes