How to customize event line content in time line tree mode


#1

before: it’s just a line of Task-D-52688
after:
maybe

Task-D-52688

btn A btn B

details:XX-XXXX-Xxx

now i have tried this
scheduler.templates.event_bar_text to return a html string template
but how can i get each instance’s event data when i click the button?


#2

Hi,

There is getEvent() method to get event object https://docs.dhtmlx.com/scheduler/api__scheduler_getevent.html


#3

thank you, but how can i get the event id(or event object),when i click the button which returns from function of scheduler.templates.event_bar_text.
may be there are 10 event lines ,each of them has my custom button in it,they are all same html string text.so i cant attach to their each event object after return
following is the code

scheduler.templates.event_bar_text = function (start, end, event) {
return `<button>my buttons</button>` //how to get event object when click ?
}

#4

There are 2 ways to get id value.

Add onclick event to the button in the template and put event id as a parameter to function

scheduler.templates.event_bar_text = function (start, end, event) {
	return '<button onclick="func('+event.id+')">my buttons</button>' 
}

The second way is using onClick handler. If also fires when you click on the button.

Check how both ways work in the sanippet http://snippet.dhtmlx.com/6218d981c


#5

thank you so much :slight_smile: