Select to view content in your preferred language

Widget Timeline timeExtent read-only error

479
0
07-08-2021 08:44 AM
gsmith15
New Contributor

I am working with ArcGIS API and react to make a webApp.  

I have added a timeline to my map using:

 

 

const timeSlider = new TimeSlider({
                    container: "timeSlider",
                    mode: "time-window",
                    view: view
                });
                view.ui.add(timeSlider, "bottom-left");

 

 

 Then I wait for the layer to be created using:

 

view.whenLayerView(foundLayer).then((lv) => {
                        console.log(lv)
                        layerView = lv;

                        const start = new Date(2021, 3, 5);
                        const end = new Date(2021, 3, 10);

                        timeSlider.fullTimeExtent = {
                            start: start,
                            end: end
                        };
                        timeSlider.timeExtent = {
                            start: start,
                            end: end
                        };
                    });

 

 

But for some reason I can not change the timeExtent.  I get the following error in my console:

"TypeError: [accessor] cannot assign to read-only property 'timeExtent' of esri.widgets.TimeSlider.TimeSliderViewModel"

I was able to get one of the examples to work in code pen, but for some reason I am not able to change the timeExtent parameter because it is read only. 

Any help is appreciated!!

Thanks!

0 Kudos
0 Replies