leaflet-timeline-slider icon indicating copy to clipboard operation
leaflet-timeline-slider copied to clipboard

How to use dynamic timelineItems?

Open sotex opened this issue 4 years ago • 3 comments

I want to use different timelineItems in different positions, I tried to use the following code:

var timelineSlider = L.control.timelineSlider({
                timelineItems: ["Day 1", "The Next Day", "Amazing Event", "1776", "12/22/63", "1984"],
                extraChangeMapParams: {greeting: "Hello World!"}, 
                changeMap: getDataAddMarkers
              });
    timelineSlider.addTo(map);
... ...

       // Change timelineItems in a callback function
        timelineSlider.remove();
        timelineSlider = L.control.timelineSlider({
                  timelineItems: timelineItems,
                  extraChangeMapParams: {greeting: "Hello World!"}, 
                  changeMap: getDataAddMarkers
                });
        timelineSlider.addTo(map);

I used the method of removing and adding to update. The user interface display is updated, but the click operation is no longer possible at the time.

sotex avatar Dec 08 '20 15:12 sotex

What do you mean by the click operation? Can you show me a reprex?

svitkin avatar Dec 10 '20 17:12 svitkin

What do you mean by the click operation? Can you show me a reprex?

Click the point on the timeline.

image

Cannot click the point on the timeline after modification.

sotex avatar Dec 14 '20 02:12 sotex

I'm really sorry for getting back to this so late, other things have come up and I am just getting around to fixing issues for this. Could you go into more detail about how you are changing the timelineItems parameter in a callback? Have you found a resolution for this issue in the meantime?

svitkin avatar Jun 14 '21 19:06 svitkin