AnsweredAssumed Answered

Multiple Time Sliders on Same Page. Bug?

Question asked by geonetadmin on Feb 28, 2012
Latest reply on Feb 29, 2012 by geonetadmin
Original User: mmoyles

I'm running into a problem using the TimeSlider dijit in the esri dojo package. I am using multiple timesliders on multiple maps on the same page. (See screenshot for better view on what I'm trying to do)

The error I'm getting is 'Tried to register widget with id==ts but that id is already registered' which has lead me to believe that the ESRI programmer who worked on this hardcoded an id somewhere in the templated time slider widget. Is the source available anywhere for me to fix the bug myself? Or does anyone have any ideas for a work around? (short of creating my own timeslider widget)

I'm setting up my timeslider like so:

template html file:
.....
<div data-dojo-attach-point="timeSliderDiv" class="center"></div>
.....

javascript view: (initSlider is an event handler called after all layers have been loading via map.addLayers(arrayOfLayers) )
dojo.declare('app.views.SimulationsView', [ dijit._Widget, dijit._Templated ], {      templateString: dojo.cache('app.views', 'Simulations/view.html'),     title: 'View Simulation',     closable: true,     data: false,     widgetsInTemplate: true,  //...................... initSlider: function(results) {         var _this = this;         console.log('initialize time slider');                  var timeLayer;         dojo.forEach(results, function(result) {             if(result.layer.id = 'Hospitals') { //not sure if this is the best layer to pull time extent from?                 timeLayer = result.layer;             }         });                  var timeSlider = new esri.dijit.TimeSlider({             id: 'TimeSlider' + _this.data.id,             style: "width: 100%;"         }, _this.timeSliderDiv);                  _this.map.setTimeSlider(timeSlider);         timeSlider.setThumbCount(1);                  dojo.connect(timeSlider, 'onTimeExtentChange', _this, _this.onTimeExtentChange);                  if(timeLayer && timeLayer.timeInfo) {                             var layerTimeExtent = timeLayer.timeInfo.timeExtent;             timeSlider.createTimeStopsByTimeInterval(layerTimeExtent, 10, 'esriTimeUnitsMinutes');             timeSlider.setThumbMovingRate(2000);             timeSlider.singleThumbAsTimeInstant(true);             timeSlider.setLoop(true);             timeSlider.startup();                    } else {                    alert('Could not load simulation MapService layers. You may need to re-crunch this simulation.');        }                      },  //......................  });


[ATTACH=CONFIG]12286[/ATTACH][ATTACH=CONFIG]12287[/ATTACH]

Attachments

Outcomes