[16.0][FIX] web_timeline: Redraw issues with initial mode #2778
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes redraw issues when setting a
mode
attribute in thetimeline
view tag.This mode specifies a default scale one would want to set; same as when clicking on Day/Week/Month buttons at the top of the view.
Initial rendering had issues here because data was loaded too soon, before the timeline component was rendered/ready. The fix is to load data into the component only after initial redraw event, called
changed
(see https://visjs.github.io/vis-timeline/docs/timeline/#Events).There was old code attempting to call
on_scale_xxx_clicked
methods at load time to simulate clicks on these Day/Week/Month buttons, but these methods have been renamed so this code is no longer working.This commit also removes the
current_window
instance variable, not needed and actually confusing as the timeline component already maintains its own start/end information (which we can query withtimeline.getWindow()
).Screenshots below with project_timeline task view with
mode="month"
Before
Only 1 line at the bottom, rest is missing
After