Calendar: How to get date range after view switch?
duzenko opened this issue · 3 comments
We switch the current view in ngAfterViewInit() depending on user's settings but getCurrentViewDates() returns an empty array.
It only works for us when called from inside the 'viewNavigate' event, but that does not fire too when doing that initial view switch.
Actually, it never fires when we have to use view's isSelected due to the interval/grouping bugs
Hi Duzenko,
Greetings from Syncfusion support.
We have validated your reported problem “How to get date range after view switch?” at our end and we were unable to reproduce the problem that you have reported at our end. We have tried to replicate the issue by changing the current view in ngAfterViewInit and get the current view dates from the getCurrentViewDates method when we click the external button. We have prepared a sample for your reference which can be available from the below link.
Sample: https://stackblitz.com/edit/ej2-angular-schedule-view-customization-sample?file=app.component.ts
Kindly try the above sample, if you still facing the same problem share the below details to serve you better.
• Where you have tried to get current view dates?
• Share the full Schedule rendering code that reproducing the problem with reproducing steps or
• Reproduce the problem in the above-shared sample or
• Share a sample that illustrates the problem which would help us to proceed further.
Regards,
Ravikumar Venaktesan
Hi Duzenko,
Greetings from Syncfusion support.
We have validated your reported problem “How to get date range after view switch?” at our end and we were unable to reproduce the problem that you have reported at our end. We have tried to replicate the issue by changing the current view in ngAfterViewInit and get the current view dates from the getCurrentViewDates method when we click the external button. We have prepared a sample for your reference which can be available from the below link.
Sample: https://stackblitz.com/edit/ej2-angular-schedule-view-customization-sample?file=app.component.ts
Kindly try the above sample, if you still facing the same problem share the below details to serve you better.
• Where you have tried to get current view dates?
• Share the full Schedule rendering code that reproducing the problem with reproducing steps or
• Reproduce the problem in the above-shared sample or
• Share a sample that illustrates the problem which would help us to proceed further.Regards,
Ravikumar Venaktesan
Thanks for the demo
I'd still like to have the dates in the ngAfterViewInit callback - is this possible? Please see my forked sample below
https://stackblitz.com/edit/ej2-angular-schedule-view-customization-sample-bwvbbh?file=app.component.ts
Hi Duzenko,
Thanks for the reply.
We have analyzed your requirement “I'd still like to have the dates in the ngAfterViewInit” at our end and let you know that the ngAfterViewInit hook method will trigger before the scheduler element got rendered in the DOM. So we couldn’t get the scheduler current view dates in that method. So, we suggest you to use dataBound event, because it will trigger after scheduler got rendered and also will trigger for date and view navigation. We have prepared a sample for your reference which can be available from the below link.
Sample: https://stackblitz.com/edit/ej2-angular-schedule-current-view-dates?file=app.component.ts
onDataBound() {
console.log(this.scheduleObj.getCurrentViewDates());
}
Kindly try the above solution and let us know if this comes close to your requirement.
Regards,
Balasubramanian S