Dispose of TimeSlider

1484
2
Jump to solution
12-10-2014 08:56 AM
DaveAdams
New Contributor III

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

  }

0 Kudos
1 Solution

Accepted Solutions
HeikoHeijenga
Esri Contributor

Try to do:

map.setTimeExtent(null)

View solution in original post

0 Kudos
2 Replies
HeikoHeijenga
Esri Contributor

Try to do:

map.setTimeExtent(null)

0 Kudos
DaveAdams
New Contributor III

That works perfectly! Rapid turnaround! Many thanks.

0 Kudos