Add button to collapse all timeline folders

Hi,

I need a button to collapse/uncollapse the level 1 folders of my timeline. I show it in the .dhx_cal_header div, like in this screenshot: i.imgur.com/2dzGX8F.png.

To avoid the scheduler redraw to remove it I create it in the onXLE and onViewChange events. Is it possible to create it only one time? Now it works but isn’t very optimum.

Thx

Hi,

Try using this sample:
docs.dhtmlx.com/scheduler/snippet/dae8db36

Hi Polina, thx for your support. In fact I already have the collapse functionality, the problem is the html button that I print inside the .dhx_cal_header div. When some events occurs (scheduler resize, custom lightbox open/close, view change, …) it disappears. I need to redraw the button on every event or there is a way to make it permanent?

I need to redraw the button on every event or there is a way to make it permanent?

Hello,
a solution depends on what exactly are you doing.
If the button should be located in the area which content is generated via template function - you can render button from that template.
Or you can trace onViewChange/onBeforeViewChange event and refresh the button docs.dhtmlx.com/scheduler/api__s … event.html , or place it in a non-refreshable area inside scheduler container and place it over calendar header using absolute positioning. Please provide some details on your use case if none of this helps

Hi,

Drawing it outside and placing it over calendar header using absolute positioning is a good solution for this particular case, thx. But it’s only an example, I really need to control some other events that are overided by scheduler redraw events, as for exemple adding .tooltip class to timeline folders and timespans.

Is there always a very last event that I can trace to make this changes to the scheduler? onViewChange/onBeforeViewChange aren’t the solution, the scheduler gets repainted after this events sometimes (onXLE, onEventDeleted, after closing a custom lightbox…)

Thx

Hi,
Currently the data area can be repainted without throwing any public event, so I suppose that is the issue - you can call scheduler.updateView or some internal methods may trigger, which will refresh the markup without a good way to detect it.

Usually such event is not needed, since html/css content is supposed to be controled via template functions which will be always called on repaint.
Regarding the timeline folders - there was a bug when related template (docs.dhtmlx.com/scheduler/api__s … plate.html) was not called for them, but it is fixed in a dev version. I can send you a latest build - please open a ticket in our support system.

As for timespans - the timespan class can be specified in timespan config (.css property), and usually if you want to change it dynamically it means that the timespan itself has been changed and you need to replace the old one with the new state (i.e. delete current one, add timespan with updated state and refresh the scheduler)
docs.dhtmlx.com/scheduler/api__s … espan.html
docs.dhtmlx.com/scheduler/api__s … espan.html

At the very last, if you still need to know when repaint happens and do some postprocessing afterwards, you can do a small workaround with overriding an internal method that triggers that repaint:
docs.dhtmlx.com/scheduler/snippet/b20de255

Thx for the detailed reply!

The last workaround seems to work! I added your patch to my calendar and now I can do that on a full repaint:

$('.tooltip').tooltip({container: 'body'});

Now even the scheduler is repainted the tooltip applies to folders and timespan.

Maybe in a future you could add an easier way to do that?

In any case, thx for your help!

Hi again,

Since the update of DHTMLX Scheduler 4.4 the patch you made in docs.dhtmlx.com/scheduler/snippet/b20de255 doesn’t work well. Now the code inside scheduler.attachEvent(“onDataRender”, function(updatedEvents){} is executed twice as before. How can I patch it to make it work? The problem is that I do an ajax request inside…

Thx

Any update on this?

Please @Aliaksandr I need some help. I’m using the last DHTMLX Scheduler version and with your patch I’ve detected that when the data/events are loaded scheduler is making a full repaint on every event. With a 300 events scheduler and your patch activated doing some JS operations it takes more than 10 seconds to load.

So, on every element that is loaded in the scheduler the bold line is executed:

if (!updatedEvents) { // full repaint [b]executed for every loaded event[/b] }

Is this an expected behavior?

Please @Aliaksandr I need some help. I’m using the last DHTMLX Scheduler version and with your patch I’ve detected that when the data/events are loaded scheduler is making a full repaint on every event. With a 300 events scheduler and your patch activated doing some JS operations it takes more than 10 seconds to load.

So, on every element that is loaded in the scheduler the bold line is executed:

if (!updatedEvents) { // full repaint [b]executed for every loaded event[/b] }

Is this an expected behavior?