Our pure JavaScript Scheduler component


Post by michael cohen »

Hello team,
I need to implement non working days (weekend) according to employee country.
As example if employee from UK ==> (Saturday, Sunday)

nonWorkingDays = {0: true, 6: true}

if from Israel ==> (Friday, Saturday)

nonWorkingDays = {5: true, 6: true}

How should I set nonWorkingDays per row? As it's possible to have mix of employees from different countries. Thanks


Post by tasnim »

It is not supported in the scheduler but it does support in scheduler pro. I would suggest you to checking out scheduler pro. We have a demo for resource nonworking time. Here it is: https://bryntum.com/examples/scheduler-pro/resource-non-working-time/

If you have any other questions please don't hesitate to ask

Good Luck :)


Post by anoop.francis »

@tasnim,
Anyway we can get this feature in Bryntum gantt? We are trying to highlight the non working days in Bryntum gantt, but seems like after giving the configs, it is still not working...


Post by alex.l »

Hi anoop.francis,

Non-working time for SchedulerPro and Gantt are driving by calendars.
Project and/or task and/or resource may have own calendar with working and non-working time periods.
When you set calendar for a resource and apply it to some task, that task will be scheduled according to that calendar.
Gantt doesn't support resource non-working time visualization now, only project's calendar may be displayed on timeAxis. But all tasks will be scheduled correctly according to your specifications.

Please check these guides to fully understand how it works:
https://bryntum.com/docs/gantt/guide/Gantt/basics/calendars
https://bryntum.com/docs/gantt/guide/engine/gantt_events_scheduling

All the best,
Alex


Post by anoop.francis »

Thanks Alex,
I was able to add/remove nonworkingtime from the gantt, but when I dod it dynamically, only when I do a zoomin or zoomout (essentially when I do change the view layout), the newly added nonworking times are getting reflected on the UI. I think I am missing something to refresh the view.
Is there anyway I can achieve that?


Post by alex.l »

TimeRanges should be removed/added using store https://bryntum.com/docs/gantt/api/Scheduler/feature/TimeRanges#config-store

Please give us code snippet how did you do that?
Here is an example how can it be managed https://bryntum.com/examples/gantt/timeranges/

const timeRangeStore = gantt.features.timeRanges.store;

timeRangeStore.add({
    name      : 'New range',
    startDate : new Date(2019, 1, 27),
    duration  : 5
});

All the best,
Alex


Post by anoop.francis »

Hi Alex,
I am adding calendar intervals for nonworking days as given below in React.

const officeHolidyList = holidays.officeHolidays.map(eachHoliday => {
      return { ...eachHoliday, cls: 'officeHoliday' };
    });

const timelineHolidayList = holidays.timelineHolidays.map(eachHoliday => {
  return { ...eachHoliday, isWorking: false, cls: 'timelineHoliday' };
});

gantt.project.calendar.beginBatch();
gantt.project.calendar.clearIntervals(false);
gantt.project.calendar.endBatch();

gantt.project.calendar.beginBatch();
gantt.project.calendar.addIntervals([
  ...officeHolidyList,
  ...timelineHolidayList,
  {
    recurrentStartDate: 'on Sat at 0:00',
    recurrentEndDate: 'on Mon at 0:00',
    isWorking: false,
  },
]);
gantt.project.calendar.endBatch();

It is added to the calendar but just that the UI gets updated on when we re-zoom the view


Post by mats »

The param to clearIntervals is silent so if you pass true, you don't need the batching.

gantt.project.calendar.beginBatch();
gantt.project.calendar.clearIntervals(false);
gantt.project.calendar.endBatch();

Also no need to batch a single operation. Just do

gantt.project.calendar.addIntervals([
  ...officeHolidyList,
  ...timelineHolidayList,
  {
    recurrentStartDate: 'on Sat at 0:00',
    recurrentEndDate: 'on Mon at 0:00',
    isWorking: false,
  },
]);

and it should refresh.


Post by mats »

Looks like a bug actually, we'll check it. https://github.com/bryntum/support/issues/5394


Post Reply