Our pure JavaScript Scheduler component


Post by glennvl91 »

Hi

I have following calendar interval set in my SchedulerPro:

project: {
    calendar: "workhours"
},
calendars: {
    rows: [
        {
             id: "workhours",
             name: "Openingsuren",
             unspecifiedTimeIsWorking: true,
             intervals: [
                  {
                       recurrentStartDate: "at 23:00",
                       recurrentEndDate: "at 17:00",
                       isWorking: false,
                       name: "Gesloten"
                  }
             ]
        }
    ]
}

This works fine, I also added the filter like in the demo https://bryntum.com/examples/scheduler-pro/non-working-time/

Now I was wondering, is there any way to allow creating events on the non-working time?

If not, is there a workaround where I can also filter working time but still can create events on the other hours when shown?

Thanks in advance.


Post by mats »

You can always add events directly to the EventStore, or implement your own UI interaction where you listen for double clicks in the nonworking time areas and add new events there.

https://bryntum.com/docs/scheduler/api/Scheduler/data/EventStore#function-add


Post by glennvl91 »

Is there a way to have a filter on hours without working hours?

Or can u give me a headstart on how to add a listener to the non-working area so it works the same as the working hours?

Thanks in advance.


Post by glennvl91 »

I managed to create a filter on the timeAxis myself by just checking the hour value.

{
            ref         : 'filterButton',
            type        : 'button',
            text        : 'Filter out non-working time',
            toggleable  : true,
            icon        : 'b-fa-square',
            pressedIcon : 'b-fa-check-square',
            onToggle({ pressed }) {
                if (pressed) {
                    scheduler.timeAxis.filterBy(function (tick) {
                        return tick.startDate.getHours() >= starthour && tick.startDate.getHours() <= endhour;
                    });
                }
                else {
                    // Restore all ticks
                    scheduler.timeAxis.clearFilters();
                }
            }
        },

Post by marcio »

Hey glennvl91,

Glad that you found a solution. As it's not the default behavior of non-working hours (they should be considered "disabled" for event scheduling), if you need something different you can achieve it by programmatically changing the behavior of the Scheduler and/or event (or others) stores.

Best regards,
Márcio


Post Reply