<e-view option='TimelineWeek' [interval]="4">
<button (click)="clickNext()">button>
<button (click)="clickPrev()">button>
[selectedDate]="selectedDate"
@ViewChild("detailedSchedule")
public detailedSchedule: ScheduleComponent;
public selectedDate: Date = new Date(2018, 7, 4);
clickNext() {
this.selectedDate = this.detailedSchedule.timelineViewsModule.renderDates[7];
}
clickPrev() {
const prevDate = new Date(this.detailedSchedule.timelineViewsModule.renderDates[0]) - 1;
this.selectedDate = new Date(prevDate);
}
<button (click)="clickNext()">button>
<button (click)="clickPrev()">button>
(dataBound)="dataBoundFn($event)"
dataBoundFn(event: object) {
$(".detailedSchedule .e-toolbar-item.e-prev.e-tbtn-align.e-overflow-show").remove();
$(".detailedSchedule .e-toolbar-item.e-next.e-tbtn-align.e-overflow-show").remove();
const nextDiv = $(`<div class="e-toolbar-item e-next e-tbtn-align e-overflow-show" aria-disabled="false" aria-label="next period" title="Next"></div>`);
const nextBtn = $(`<button class="e-tbar-btn e-control e-btn e-lib e-icon-btn" type="button" tabindex="-1" style="width: auto;" title="Next"></button>`);
const nextSpan = $(`<span class="e-btn-icon e-icon-next e-icons"></span>`);
nextBtn[0].addEventListener("click", this.clickNext.bind(this));
nextBtn.append(nextSpan);
nextDiv.append(nextBtn);
const prevDiv = $(`<div class="e-toolbar-item e-prev e-tbtn-align e-overflow-show" aria-disabled="false" aria-label="previous period" title="Previous"></div>`);
const prevBtn = $(`<button class="e-tbar-btn e-control e-btn e-lib e-icon-btn" type="button" tabindex="-1" style="width: auto;" title="Previous"></button>`);
const prevSpan = $(`<span class="e-btn-icon e-icon-prev e-icons"></span>`);
prevBtn[0].addEventListener("click", this.clickPrev.bind(this));
prevBtn.append(prevSpan);
prevDiv.append(prevBtn);
if (!$(".detailedSchedule .e-toolbar-item.e-next.e-tbtn-align.e-overflow-show").length) {
$(".detailedSchedule .e-toolbar-left").prepend(nextDiv);
}
if (!$(".detailedSchedule .e-toolbar-item.e-prev.e-tbtn-align.e-overflow-show").length) {
$(".detailedSchedule .e-toolbar-left").prepend(prevDiv);
}
}
I know this is an old thread, there still doesn't seem to be a native way of handling this.
Although it is a solid workaround, with all due respect to the excellent effort put in by Luca, it does feel a little hacky because it is not a smooth user experience - especially when you click "Next" period in Agenda View and you can see the native date range shown and then a split second later, the newly calculated date range.
Could you please provide a "Navigation Interval" for each view type so the ranges can be different depending on the view?
Hi Joseph,
Sample: https://stackblitz.com/edit/angular-vkzsgc-9t3zzb?file=package.json,app.component.html,app.component.ts,app%2Fapp.module.ts
To resolve the issue check whether args.event is present within the onActionBegin method. If it is, set args.cancel=true. Additionally, you can use the
getCurrentViewDates method to retrieve the rendered dates. To add additional
days, utilize the addDays method, as shown in the highlighted code snippet
below. Refer
to the modified sample provided above.
[app.component.ts]
onActionBegin(args) { if (args.requestType == 'dateNavigate' && args.event) { |
Regards,
Venkatesh