Open Quentius opened 3 years ago
@Quentius If I understand correctly, you mean you can't use the arrow button to change the month to previous/next month? I tried your code, it seems working. I notice you did a lot of pure JavaScript DOM manipulations, I suggest not to do that as Angular may not notice these changes. You also override some CSS styles, try to remove them to see if it works. If you want to hide the event detail section, there's a showEventDetail option.
Hello! I have the same problem. I'm not doing any manual dom manipulation and I'm using the component inside a modal... Have you found a solution? I can try to provide a demo in case. The problem for me appear after the second time I open the modal
Maybe the problem is that the calendar store some data into a service and they are not reinitialized when a component is destroied and recreated?
Hello, i created a small stackblitz example to show the problem: https://stackblitz.com/edit/ionic-5-angular-10-start-template-x8pmlu?file=src/app/tab1/calendar-modal.component.ts Calendar work fine the first time but after it show a wrong month and slides work in "free" mode. Thanks for the help
Hi @twinssbc! Can you please look if the problem is simple to solve now that there is a stackbliz? Many Thanks for your time
Here is a video of my issue. If i open the modal i cant select a date without first swiping to the next month.
@davidecampello @Quentius The reason because of this issue is the calendar was loaded before the page is fully rendered. To solve it, you could add ngif to hide the calendar at the beginning, and set it to true in the ionViewDidEnter event.
For example,
This is the template, notice I use showCalendar to control the visibility
<ion-header>
<ion-toolbar>
<ion-title>{{ viewTitle }}</ion-title>
<ion-buttons slot="end">
<ion-button (click)="today()">
Today
</ion-button>
<ion-button (click)="changeMode('month')">M</ion-button>
<ion-button (click)="changeMode('week')">W</ion-button>
<ion-button (click)="changeMode('day')">D</ion-button>
<ion-button (click)="loadEvents()">Load Events</ion-button>
<ion-button (click)="close()">close</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content *ngIf="showCalendar">
<calendar
[calendarMode]="calendar.mode"
[currentDate]="calendar.currentDate"
(onCurrentDateChanged)="onCurrentDateChanged($event)"
(onEventSelected)="onEventSelected($event)"
(onTitleChanged)="onViewTitleChanged($event)"
(onTimeSelected)="onTimeSelected($event)"
[step]="calendar.step"
>
</calendar>
</ion-content>
Then in the component ts
showCalendar:boolean;
ionViewDidEnter() {
this.showCalendar = true;
}
Thank you very much @twinssbc, I'll try and let you know
@davidecampello @Quentius
showCalendar:boolean;
ionViewDidEnter() {
this.showCalendar = true;
}
Thanks guys, it´s worked fine.
@davidecampello @Quentius
showCalendar:boolean; ionViewDidEnter() { this.showCalendar = true; }
Thanks guys, it´s worked fine.
Hi. this works also for me but i'm facing another issue which is i can't acess the calendar programaticaly in the ts file using viewchild
ngAfterViewInit(){ setTimeout(() => { this.myCalendar.update(); }) }
Use this method after init. it´s worked fine.
The calendar inside my modal is bugged.
Description: The Arrows next to the date (Februari 2021 as example) Ain't working on the screenshot. To make the swiping work, and actually be able to click on dates I need to swipe the calendar manually to the month next. Thats where the current date is.
It is important to check the dates in the pictures Example swipe: https://ibb.co/QN6TMfg How it is right now: https://ibb.co/gzRgWqh How it should be: https://ibb.co/ZT49tLX
Typescript:
HTML:
SCSS
The red surrounded line is the issue. Is there a way to remove it?