Dynamically setting startDate and endDate for the scheduler based upon events
Dynamically setting startDate and endDate for the scheduler based upon events
Hi. I'm evaluating your product for use in a SaaS project. I'm currently within the free trial period. Is there an example of how to dynamically set the startDate and endDate for a scheduler based upon the events resource array? THe documentation hints at it.
For example, if I comment out setting startDate and endDate in the React Simple Example (lines 97 and 98 of examples/react/simple/src/Main.js), I would expect autoAdjustTimeAxis to kick in as it's true by default; but it doesn't and instead shows the current time + 24 hours?
For example, if I comment out setting startDate and endDate in the React Simple Example (lines 97 and 98 of examples/react/simple/src/Main.js), I would expect autoAdjustTimeAxis to kick in as it's true by default; but it doesn't and instead shows the current time + 24 hours?
Code: Select all
<BryntumScheduler
ref={'scheduler'}
// Make grid grow to fit rows
autoHeight={true}
// Initial row height
barMargin={this.state.barMargin}
// startDate={new Date(2017, 1, 7, 8)}
// endDate={new Date(2017, 1, 7, 18)}
Re: Dynamically setting startDate and endDate for the scheduler based upon events
You can set 'startDate' and 'endDate' anytime, as you can see in our API docs. So after you load your data you can ask the eventStore for the date range in the contents and just set it yourself. Docs:
https://bryntum.com/docs/scheduler/#Scheduler/view/mixin/TimelineZoomable#function-setTimeSpan
https://bryntum.com/docs/scheduler/#Scheduler/data/mixin/EventStoreMixin#function-getTotalTimeSpan
https://bryntum.com/docs/scheduler/#Scheduler/view/mixin/TimelineZoomable#function-setTimeSpan
https://bryntum.com/docs/scheduler/#Scheduler/data/mixin/EventStoreMixin#function-getTotalTimeSpan
Tired of debugging javascript errors in web applications? Try our new error logging service RootCause, or read more on the Sencha blog
@bryntum
Facebook
API documentation
@bryntum
API documentation
Re: Dynamically setting startDate and endDate for the scheduler based upon events
Thanks. Will try that. What's the purpose of autoAdjustTimeAxis then? I'm struggling to understand what effect it has.
- sergey.maltsev
- Core Developer
- Posts: 683
- Joined: Mon Dec 24, 2018 9:15 am
Re: Dynamically setting startDate and endDate for the scheduler based upon events
Hi, KevinMonk!
When autoAdjustTimeAxis is false scheduler uses the exact configured dates, by keeping it as true it adapts to the used viewpreset.
For example showing a full week even if configured with a Wednesday as the startdate.
Or if viewpreset configured with days and startdate is at 08:00, it will show from the start of the day instead to keep ticks whole.
It sets autoAdjust on TimeAxis
https://www.bryntum.com/docs/scheduler/#Scheduler/data/TimeAxis#config-autoAdjust
When autoAdjustTimeAxis is false scheduler uses the exact configured dates, by keeping it as true it adapts to the used viewpreset.
For example showing a full week even if configured with a Wednesday as the startdate.
Or if viewpreset configured with days and startdate is at 08:00, it will show from the start of the day instead to keep ticks whole.
It sets autoAdjust on TimeAxis
https://www.bryntum.com/docs/scheduler/#Scheduler/data/TimeAxis#config-autoAdjust