bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

Non-working time ranges are not redrawn on calendars inline assignment #9853

Open SergeyMaltsev opened 2 months ago

SergeyMaltsev commented 2 months ago

See

    // https://github.com/bryntum/support/issues/9853
    t.it('Should redraw non-working ranges on calendars inline assignment', async t => {

in 9853-assign-calendars branch in SchedulerPro/tests/features/NonWorkingTime.t.js

Also sample code Try click Use non-working time intervals few times. Regions will disappear Click handler has line which helps to show regions.

import SchedulerPro from '../../lib/SchedulerPro/view/SchedulerPro.js';

const calendars = [
    {
        id                       : 'workhours',
        name                     : 'Working hours',
        unspecifiedTimeIsWorking : true
    }
];

const calendarsWithIntervals = [
    {
        id                       : 'workhours',
        name                     : 'Working hours',
        unspecifiedTimeIsWorking : true,
        intervals                : [
            {
                startDate : new Date(2020, 2, 23, 2, 0),
                endDate   : new Date(2020, 2, 23, 4, 0),
                isWorking : false,
                cls       : 'factoryShutdown',
                name      : 'Factory shutdown'
            }
        ]
    }
];

const scheduler = new SchedulerPro({
    project : {
        calendars : calendarsWithIntervals,
        calendar  : 'workhours'
    },
    appendTo   : 'container',
    startDate  : '2020-03-23',
    endDate    : '2020-03-28',
    viewPreset : 'hourAndDay',

    columns : [
        { field : 'name', text : 'Staff', width : '10em' }
    ],

    tbar : [
        {
            ref     : 'clearIntervalsCheck',
            type    : 'checkbox',
            text    : 'Use non-working time intervals',
            checked : true,
            onChange({ checked }) {
                scheduler.calendars = checked ? calendarsWithIntervals : calendars;
                // The line below helps
                //scheduler.features.nonWorkingTime.attachToCalendar(scheduler.calendar);
            }
        }
    ]
});