Question about getting section API

Hello,

I’m using JavaPlanner for my application. Unfortunately, I’ve encountered a problem with JavaPlanner and I’m hoping maybe someone could please help me.

I’m implementing a scheduler with a timeline (function: scheduler.createTimelineView()). When user left clicks on section item (parameter: y_unit) - the whole section should be selected and user should be allowed to interact with selected section by using keyboard shortcuts.

I’m able to handle keyboard shortcuts, however I’m not able to get the selected section’s object. So far I’ve managed to write the following code:

scheduler.attachEvent("onEmptyClick", function (date, e){ var sectionObject = scheduler.getActionData(e); if (sectionObject && sectionObject.section) { var sectionId = sectionObject.section; console.log("section ID:", sectionId); // How to get section object by using section ID? } });

There is a method called getSection() (docs.dhtmlx.com/scheduler/api__s … ction.html) however it doesn’t work if the timeline is not in Tree mode.

So, my question is: how to get section object by using it’s section ID?

There is no way to get section object by its id in common case
You can access the collections of all options like next

scheduler.matrix.timeline.y_unit

and find the related object in it.