weralio

Set initial value of HORIZONTALSLIDER not working

Discussion created by weralio on Aug 14, 2013
Latest reply on Aug 14, 2013 by zj_zou
I have a feature layer with attached dijit horizontalslider

Initially the layer is not visible and I'll like to programatically enable it (I'm doing that) but with the slider set in the middle (value 0.5, i.e. Opacity= 0.5). I cannot do this.. the layer appears with the slider on the beginning but no opacity and as soon as I move it to the right it'll go from 0 to 1


Declaration:

            // FLOOD LAYER
            featureLayerFL = new esri.layers.FeatureLayer('<s:property value = "arcGisFeatureLayerUrl" />/mxds/manmapC/MapServer/12', {
                mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
                outFields: ['*'],
                opacity: 1
            });
            legendLayers.push({
                layer: featureLayerFL,
                title: 'FLOOD'
            });
            featureLayerFL.hide();
            dojo.connect(featureLayerFL, 'onMouseOver', showTooltipFL);
            dojo.connect(featureLayerFL, 'onMouseOut', closeDialogFL);
   featureLayerFloodSlider = new dijit.form.HorizontalSlider();
   featureLayerFloodSlider.id = "Flood Slider";
   featureLayerFloodSlider.value=0.5;
   featureLayerFloodSlider.layerID = 12;
   featureLayerFloodSlider.minimum = 0;
   featureLayerFloodSlider.maximum = 1;
   featureLayerFloodSlider.tooltip = "Flood";
   featureLayerFloodSlider.intermediateChanges = true;
   featureLayerFloodSlider.showButtons = true;

   featureLayerFloodSlider.style = "width:100px";
   //featureLayerFloodSlider.onChange = function(){slideLayerOpacity(12,this.value)}
   featureLayerFloodSlider.onChange = function(){slideLayerOpacity(12,featureLayerFloodSlider.value)}
   featureLayerFloodSlider.handleSrc = "https://serverapi.arcgisonline.com/jsapi/arcgis/1.1/js/dojo/dijit/themes/tundra/images/preciseSliderThumb.png";


Part when I make visible and try to set value to 0.5
                   featureLayerFL.setVisibility(true);
                   featureLayerFloodSlider.value=0.5;
                   map.graphics.refresh();

Outcomes