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

set_scroll_position not moving Gannt Chart in scrollable area when manually set. #444

Closed
mtmulch0191 opened this issue Sep 26, 2024 · 1 comment

Comments

@mtmulch0191
Copy link

Hello there,

We directly forked this library into our Angular application as we where having web-pack issues.

When rendering the Gantt chart there is a method to set the scroll position of the parent container's scrollbar. It makes sense in the weekly view to not perform a scroll to the start of the current month because the scroll_pos variable calculation comes back as 0. However, if I manually attempt to set that variable to scroll left by 100-5000 it doesn't move the scroll container.

I know you probably don't support direct forks but I was curious if this was working as intended.

set_scroll_position(date) {
        if (!date || date === 'start') {
            date = this.gantt_start;
        } else if (date === 'today') {
            return this.scroll_today();
        } else if (typeof date === 'string') {
            date = date_utils.parse(date);
        }

        const parent_element = this.$svg.parentElement;
        if (!parent_element) return;

        const hours_before_first_task =
            date_utils.diff(date, this.gantt_start, 'hour') + 24;

        const scroll_pos =
            (hours_before_first_task / this.options.step) *
                this.options.column_width -
            this.options.column_width;
        parent_element.scrollTo({ left: scroll_pos, behavior: 'smooth' });
    }
@mtmulch0191
Copy link
Author

I was able to get ahold of our UI developer that set this up. We were able to determine that our scroll container wasn't be correctly targeted it was actually the grandparent that was the scroll container. I am not sure if that was because we are importing this an Angular component and use hostElement but I changed it in our code. I am now able to customize the scroll for our weekly view.

I will close this out.

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

No branches or pull requests

1 participant