I am trying to use the toolbar checkbox to toggle between 24h and working hours, and trying to use this to update the configuration:
onAction(e) {
let workingTime = {};
if (e.checked) {
workingTime = {
fromDay: 1,
toDay: 6,
fromHour: 0,
toHour: 24
}
} else {
workingTime = {
fromDay: 1,
toDay: 6,
fromHour: 7,
toHour: 21
}
}
const updatedConfig = {...scheduler.config, workingTime};
//1st attempt
scheduler.setConfig(updatedConfig); // breaks with and error
//2nd attempt
scheduler.setConfig({workingTime}); // passes but doesn't do anything
//3rd attempt
scheduler.setConfig(workingTime); // same as previous (or breaks, can't remember
//do I need to use any of these to refresh the the UI after config update?
//scheduler.refreshWithTransition();
// scheduler.setTimeSpan(scheduler.startDate, scheduler.endDate);
}
You can see the comments in the code what I have tried. Should it be done some other way?
Ah, ok, that's easier than I expected. I checked the example, but you are not changing the header of the scheduler, just basically compressing the time range available inside the fixed week period. I need to update the time axis to show me either 00-24 or 07-21 time in the header (my header shows the date and underneath hours, and this should be for both single or multiple days). Same thing with working days, I want to hide Saturday or Sunday, or both. So I need to rerender the complete scheduler (both grid and header) and update visible timespan for day(s) or hide days, depending of the change. workingTime property does it all but I can't find how to update the UI.
In your example you are rendering a few different schedulers and then switching inbetween them if I understand the example correctly. That is a bit too much of an overhead for what I need.
I actually managed to get the functionality that I want but it is acting quite strange. In some cases it works perfectly and in some it just doesn't work or messes up the the view.
I do this after the working time updated
Then when switch between 1,2,3,5 days view and different dates it sometimes works sometimes not.
In documentation it says that renderContents rerenders both the grid and header. I am still trying to figure out in what cases it not to work, and why in some cases it works perfectly fine. Would it help if I would post the scheduler config and toolbar code here for you to check out?
Ok, just to mention that without calling the renderContents, when it works, after workingTime update (let's say change from 07-21 to 00-24) the view is updated with additional timespan but the time before and after the working hours is not rendered in the header, it's just expanded and emtpy.
here to all the button calls just to see if it will make any difference, but in general it would make sense to me to use it only after the workingTime has been updated.
Could you please provide your code as a ZIP containing a runnable example? To create a testcase please apply minimal changes to one of our demos. Do not include node_modules and our sources, just demo code. We should be able to compile and run it. Please also attach a video/gif showing how the content gets changed for you and what exactly you'd like to change. And mention the Scheduler version you're using. Is it a simple scheduler or pro?
And I attached a working example. It is a simple angular app that just shows the scheduler.
Bryntum code is in Bryntum.Scheduler folder, I removed the code and left just the empty folder.
For some reason it renders it twice and just renders the header and toolbar, but it should be enough to see what is happening. In general event data that renders matches the time from header so when header works correctly probably everything will. Just try switching next/today/previous day, datepicker with 1/2/3/5 days and hide days and you will see that some combinations work and some don't.
For example, when I just load, and change 24h, nothing happens, if I press 1 day/ 2 days and then 24h it changes but throws in part of 3rd day. In some combinations it adds hours from midnight to 7/8h am but renders only time till e.g 16h and leftover time till 24h is not shown. And then in some cases, I think if I change datepicker value and play with 24h it sometimes works perfectly fine. Then when I turn on and off Saturday or Sunday the shaded part for these days missaligns with the expected position for these days.