Our pure JavaScript Scheduler component


Post by sactory »

Hi Dev team,

I'm working with Bryntum Scheduler and having a lot of requests from client with zoomLevel 11.

From zoomLevel 12 onward event drag/drop, resize, scheduleTooltip features (and also drag tooltip, resize tooltip) are working with time block, meaning you can drag/drop or resize event to the next/previous point in time (may be next 30 minutes, 1 hour...), move the cursor along an empty cell and the tooltip will display next/previous point in time...

But on zoomLevel 11 you can only work with day: drag/drop, resize event to the next/previous day, scheduleTooltip always display hour as 12:00 AM when you move the cursor in empty cell, even though the cell is still pretty wide - or long depends on mode.

Is there anyway we can allow scheduler features to work with time block - ideally would be 1 hour - instead of a whole day at zoomLevel 11?

Thank you.


Post by arcady »

Sure that's doable:

const
    // get default zoom presets
    presets   = PresetManager.records,
    // making a new view preset
    newPreset = PresetManager.createRecord(
        Object.assign(
            {},
            // use the data of preset #11 as basic
            presets[11].data,
            // but override time resolution to hours
            {
                timeResolution : {
                    unit      : 'hour',
                    increment : 1
                }
            }
        )
    );

// replace default zoom level #11 with our custom one
presets.splice(11, 1, newPreset);

const scheduler = new Scheduler({
    // provide our customized zoom presets
    presets,
    ...

An example of standard presets modifying can be found in this demo. Check its source code for more info.

Related docs:
https://bryntum.com/docs/scheduler/#Scheduler/view/Scheduler#config-presets
https://bryntum.com/docs/scheduler/#Scheduler/preset/PresetManager#function-createRecord


Post by arcady »

actually making a new preset can look even shorter:

    // making a new view preset
    newPreset = PresetManager.createRecord(
        {
            base           : presets[11].id,
            // but override time resolution to hours
            timeResolution : {
                unit      : 'hour',
                increment : 1
            }
        }
    );

Post by sactory »

Thank you arcady, your solution works really well.


Post Reply