Unit View - Display Event Count

Is there a way to display the number of events for each unit on the unit view column headers?
Please help us out with the code snippet on how to implement that.


You can implement it using unit_scale_text template. Get events in the active view and check their section_id value:

scheduler.templates.unit_scale_text = function(key, label, unit) {
	var evs = scheduler.getEvents(scheduler.getState().min_date, scheduler.getState().max_date); 
	var count = 0;
  	for (var i=0; i<evs.length; i++){
       if(evs[i].section_id == key)
    return label + ", events: "+count;

Thanks Polina, We will try the solution you proposed and will let you know the result.

Terence George

We tried this logic you gave, but it is not giving the count correctly as it is taking some other events too and giving a higher count? We tried workarounds on top of what you gave, but was able to get a resolution.
Do you need any other information from us?