I’m using week_unit view and I’d like the column of every unit to show the number of events in that column. I’ve already used getEvents() to populate an array of counts for each date/resource combination. I can use that array to show the count in day view and in week view using the scale_text template. But in week_unit view, I can’t figure out how to determine the date of the current column.
This is the code I’m using:
scheduler.templates.week_unit_scale_text = function(key, label, unit) {
if (x.resource_count_unit[date_format(scheduler.getState().date)]) {
return label + ': ’ + “” + x.resource_count_unit[date_format(scheduler.getState().date)][key] + “”;
}
return true;
};
Of course, the getState.date() is using the date for the beginning of the week, not for the column in question.
Check the console in the snippet, there you can see how to get the required date in the week_unit_scale_text template. http://snippet.dhtmlx.com/82b74b515
That looks like it’s almost doing what I need. Strangely, the log looks OK, but if I return the date you generated as part of the template, it’s one day off.
Yes, it’s strange. To solve the issue, “return scheduler.date.add(targetWeekUnitDate, 1, ‘day’)” from week_unit_scale_text template http://snippet.dhtmlx.com/f418c3a88
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan