Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] web_timeline: Redraw issues with initial mode #2778

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

houzefa-abba
Copy link
Member

This commit fixes redraw issues when setting a mode attribute in the timeline 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 with timeline.getWindow()).


Screenshots below with project_timeline task view with mode="month"

Before

Only 1 line at the bottom, rest is missing
Screenshot at 2024-03-21 17-36-09

After

Screenshot at 2024-03-21 17-36-42

@OCA-git-bot
Copy link
Contributor

Hi @tarteo,
some modules you are maintaining are being modified, check this out!

@houzefa-abba houzefa-abba force-pushed the 16.0-timeline-fix-init-mode branch 2 times, most recently from 9af1467 to 69f6ecc Compare March 21, 2024 16:58
@houzefa-abba houzefa-abba force-pushed the 16.0-timeline-fix-init-mode branch 4 times, most recently from 63281ee to 6403e31 Compare April 4, 2024 07:41
This commit fixes redraw issues when setting a `mode` attribute in the
`timeline` 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 with
`timeline.getWindow()`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants