[app.component.html]
<ejs-gantt # gantt
//...
(queryTaskbarInfo) = "queryTaskbarInfo($event)">
</ejs-gantt>
[app.component.ts]
public queryTaskbarInfo(args: any): void {
var startDate = args.data.taskData.HolidayStart;
var endDate = args.data.taskData.HolidayEnd;
if(!isNullOrUndefined(startDate) && !isNullOrUndefined(endDate)) {
var diff = endDate.getTime() - startDate.getTime();
var width = (diff / (1000 * 60 * 60 * 24)) * this.ganttObj.perDayWidth;
var taskbar = args.taskbarElement.getElementsByClassName("e-gantt-child-taskbar");
if (taskbar.length > 0) {
var left = this.ganttObj.dataOperation.getTaskLeft(args.data.StartDate, args.data.ganttProperties.isMilestone);
var holidayleft = this.ganttObj.dataOperation.getTaskLeft(startDate, args.data.ganttProperties.isMilestone)
var element = document.createElement("div");
element.className = 'e-custom-taskbar';
element.style.width = width + 'px';
element.style.left = (holidayleft - left) + 'px';
taskbar[0].appendChild(element);
}
}
} |
[app.component.html]
//…
<ejs-gantt id="ganttDefault" [dayWorkingTime] = "dayWorkingTime"></ ejs-gantt >
//…
[app.component.ts]
//…
export class AppComponent {
public dayWorkingTime: object;
public ngOnInit(): void {
this.dayWorkingTime = [ {from: 0, to: 24 } ];
}
}
//… |