Show cool things you have done with our products


Post by KevinMonk »

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?
                <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)}


Post by mats »

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

Post by KevinMonk »

Thanks. Will try that. What's the purpose of autoAdjustTimeAxis then? I'm struggling to understand what effect it has.

Post by sergey.maltsev »

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

Post Reply