Add id to marked timespan

Hi,

I am adding marked time spans to Day View as follows.

scheduler.TimeSpans.Add(new DHXMarkTime()
{
StartDate = “”,
EndDate = “”,
CssClass = “schedule”,
HTML = “Available”
});

I want to pass a id to each time span. is it possible? I am looking for something like below.

scheduler.TimeSpans.Add(new DHXMarkTime()
{
StartDate = “”,
EndDate = “”,
CssClass = “schedule”,
HTML = “Available”,
Id = 1
});

I need the id to create events on the marked time spans.

Hi,
unfortunately there is no built-in way for accessing timespan elements by id, nor for assigning an id to one.
The closest possible thing is to inject a custom element into HTML of the timespan, and assign an id to it.
Then you’ll be able to access the marked timespan as a parent element of the injected item:[code]scheduler.TimeSpans.Add(new DHXMarkTime()
{
StartDate = “”,
EndDate = “”,
CssClass = “schedule”,
HTML = "Available ",
Id = 1
});

//JS:
var timespan = document.getElementById(‘some_id’).parentNode;[/code]

However, if you’re going to modify or attach events to the marked timespans from a custom code, there would be a certain difficulties.
Marked timspans, as well as the rest of calendar data, can be repainted when it is necessary for the component. That means that old elements will be removed and new one placed instead.
When it happens, all external changes and events attached to timespan element will be lost.

The possible way to solve it, is to delegate event to an element that won’t be re-rendered (.dhx_cal_data), or to use API events provided by the component docs.dhtmlx.com/scheduler/api__s … event.html

It worked. Thank you.