Our pure JavaScript Scheduler component


Post by Exigo »

Hello,

I have been trying to save the users current viewsettings when the user navigates away from the scheduler and then I wish to implement these settings again once the user comes back, so that they are presented with the same view.

I save the start and end date from this.scheduler.getVisibleDateRange(), which works just fine.

However when i try to use this.scheduler.zoomTo() when the user comes back, the scroll bar in the bottom is removed as it is "stuck" within the zoomed to date range.

Before navigating away:

Before.PNG
Before.PNG (88.69 KiB) Viewed 1091 times

After navigating back:

after.PNG
after.PNG (82.72 KiB) Viewed 1091 times

Notice the bottom scroll bar missing

Is there a way to set the visible Date range without messing with the scroll functions?

As a side note I would like to be able to listen to scroll changes (from left to right) is that possible? I could not seem to find it in the docs.


Post by mats »

We don't support this I'm afraid but it's a reasonable suggestion. For now you can try experimenting with the leftMargin/rightMargin configs:

/**
     * Zooms to passed view preset, saving center date. Method accepts config object as a first argument, which can be
     * reduced to primitive type (string,number) when no additional options required. e.g.:
     * ```     * // zooming to preset
     * scheduler.zoomTo({ preset : 'hourAndDay' })
     * // shorthand
     * scheduler.zoomTo('hourAndDay')
     *
     * // zooming to level
     * scheduler.zoomTo({ level : 0 })
     * // shorthand
     * scheduler.zoomTo(0)     * ```
     *
     * It is also possible to zoom to a time span by omitting `preset` and `level` configs, in which case scheduler sets
     * the time frame to a specified range and applies zoom level which allows to fit all columns to this range. The
     * given time span will be centered in the scheduling view (unless `centerDate` config provided). In the same time,
     * the start/end date of the whole time axis will be extended to allow scrolling for user.
     * ```     * // zooming to time span
     * scheduler.zoomTo({ startDate : new Date(..), endDate : new Date(...) })
     *     * ```
     *
     * @param {Object|String|Number} config Config object, preset name or zoom level index.
     * @param {String} config.preset Preset name to zoom to. Ignores level config in this case
     * @param {Number} config.level Zoom level to zoom to. Is ignored, if preset config is provided
     * @param {Date} config.startDate New time frame start. If provided along with end, view will be centered in this time
     * interval (unless `centerDate` is present)
     * @param {Date} config.endDate New time frame end
     * @param {Date} config.centerDate Date that should be kept in the center. Has priority over start and end params
     * @param {Number} config.width Lowest tick width. Might be increased automatically
     * @param {Number} [config.leftMargin] Amount of pixels to extend span start on (used, when zooming to span)
     * @param {Number} [config.rightMargin] Amount of pixels to extend span end on (used, when zooming to span)
     * @param {Number} [config.adjustStart] Amount of units to extend span start on (used, when zooming to span)
     * @param {Number} [config.adjustEnd] Amount of units to extend span end on (used, when zooming to span)
     * @category Zoom
     */

I've opened this feature request to investigate. https://github.com/bryntum/support/issues/1170


Post by Exigo »

Definetly something I would be very interested in, thanks. I can't see the ticket though.


Post by mats »

Yeah GitHub seems down today.


Post Reply