[REACT] Gantt change viewPreset but today should stay visible
Posted: Tue Jun 06, 2023 2:05 pm
by natasha.osipenko
Hi,
I change viewPreset of Gantt manually according to user interaction.
Is it possible current date stay visible when viewPreset change.
For example, I have following
Screenshot 2023-06-06 at 13.55.10.png (360.89 KiB) Viewed 517 times
Then click "w" and set Gantt viewPreset to 'weekAndDay'.
Screenshot 2023-06-06 at 13.55.59.png (313.9 KiB) Viewed 517 times
I expect to see current week instead of future week.
Is it possible?
Re: [REACT] Gantt change viewPreset but today should stay visible
But changing the preset actually shouldn't move to the future week, are you able to replicate that in one of our demos, or create a sample project for us to check that?? You can get more information about that here https://www.bryntum.com/forum/viewtopic.php?f=1&t=772
Re: [REACT] Gantt change viewPreset but today should stay visible
Posted: Tue Jun 06, 2023 3:48 pm
by natasha.osipenko
Hi marcio, thanks for the answer!
What event listener (after viewPreset change) should I use to apply setTimeSpan?
Re: [REACT] Gantt change viewPreset but today should stay visible
Fired when the range of dates encapsulated by the UI changes. This will be when moving a view in time by reconfiguring its timeAxis. This will happen when zooming, or changing viewPreset.
Re: [REACT] Gantt change viewPreset but today should stay visible
Posted: Tue Jun 06, 2023 9:52 pm
by natasha.osipenko
Hey,
Unfortunately, dateRangeChange event is not fired when change viewPreset
Re: [REACT] Gantt change viewPreset but today should stay visible
After that I zoomed in/out with trackpad or with header menu and always have event triggered.
Please check that and provide steps to reproduce if you have scenario when it's not triggered.
Re: [REACT] Gantt change viewPreset but today should stay visible
dateRangeChange is fired with component initiation. And not fired if viewPreset is changed through the code
Re: [REACT] Gantt change viewPreset but today should stay visible
Posted: Wed Jun 07, 2023 6:04 pm
by alex.l
I see all working as expected in our demo code, please see an app attached. We need your full runnable application to debug.
Re: [REACT] Gantt change viewPreset but today should stay visible
Posted: Wed Jun 07, 2023 10:40 pm
by natasha.osipenko
Hi,
It's complex to add my full running app)
In your example you use zoom and event is triggered.
But in my app I don't use zoom, I just changed viewPreset programmatically according to what user selects (please see my code above). And event is not triggered...
In general, I need to implement 'day', 'week', 'month', 'year' views for gantt (please see toggle group on my first screenshot)
Is it right to change viewPreset programmatically for this? Like below
Re: [REACT] Gantt change viewPreset but today should stay visible
Posted: Thu Jun 08, 2023 10:09 am
by alex.l
I've attached runnable code with listener added as on your code snippet. Please see it's working well.
We need more details from you to reproduce this. Please try to replicate the issue in our example app, if no luck, we need you attach your runnable application.
TO run the app attached