AnsweredAssumed Answered

Dispose of TimeSlider

Question asked by dave_adams on Dec 10, 2014
Latest reply on Dec 10, 2014 by dave_adams

I have implemented a time slider in an application on an image service. I have a a routine which pops up a div and starts the time slider but I am struggling to find the right steps to close it back down properly. I need the image service to reset itself so that the time extent is no longer applied and all the imagery displays correctly again when the time slider is removed. At the moment the time filter is still applied after I have closed the div. Any tips for removing the time slider object and the time extent would be greatly appreciated.

 

My routine to initiate the time slider:

function initSlider() {

   var timeSlider = new TimeSlider({

            style: "width:100%;"

          }, dom.byId("timeSliderDiv"));

   map.setTimeSlider(timeSlider);

 

   var timeExtent = new TimeExtent();

          timeSlider.setThumbCount(1);

          timeExtent = imageServiceLayer100m.timeInfo.timeExtent;

          timeSlider.createTimeStopsByTimeInterval(timeExtent, 1, 'esriTimeUnitsYears');

          timeSlider.setThumbMovingRate(2000);

          timeSlider.singleThumbAsTimeInstant(true);

          timeSlider.startup();

  

   //add labels for every other time stop

          var labels = array.map(timeSlider.timeStops, function(timeStop, i) {

            if ( i % 2 === 0 ) {

              return timeStop.getUTCFullYear();

            } else {

              return "";

            }

          });

          timeSlider.setLabels(labels);

  }

 

I now need to change the settings in a close function:

  function closeSlider() {

   ?

   imageServiceLayer100m.setUseMapTime = false; //this doesn't make any difference

  }

Outcomes