onBeforeSectionRender breaks timeline rows

Is this a bug?


It seems like an issue. Possibly its behaviour will be corrected in future.
Currently this event expects object to be returned and can’t be canceled.
For example:

Thank you for your answer. I still have problems with tree timeline mode: http://docs.dhtmlx.com/scheduler/snippet/1c7372b1
Is there a workaround for this?
I’m looking for a way to set the state of tree branches: opened/closed on the client, before tree rendering. Any chances for this?


To open or close section you can use openSection or closeSection function:
docs.dhtmlx.com/scheduler/api__s … ction.html
docs.dhtmlx.com/scheduler/api__s … ction.html
You could also try to use serverList for your sections. Something like following:

var sections = scheduler.serverList("sections").slice(); sections[0].open = false; scheduler.updateCollection("sections", sections);

If it doesn’t work for you and you really need to close some sections before rendering, the only way is to reset y_unit. You could try to do it with private function _getArrayForSelect. In tree view y_unit contains sections showing currently, and your sections (used in initialization) goes to y_unit_original property. So, you can set open property to needed section and get new y_unit from y_unit_original.
You can get section which you want to change with getSection function. Than you can do something like following to reset sections:
scheduler.matrix.timeline.y_unit = scheduler._getArrayToDisplay(scheduler.matrix.timeline.y_unit_original);
In this case you should also reset order, because it will be broken.
For example:

var obj = scheduler.matrix.timeline obj.order = {} for(var i=0; i<obj.y_unit.length;i++) obj.order[obj.y_unit[i].key]=i;

Sorted with serverList.