Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to turn off moving to previous month when event clicked #885

Closed
kisielm opened this issue Feb 18, 2019 · 7 comments · Fixed by #892
Closed

Option to turn off moving to previous month when event clicked #885

kisielm opened this issue Feb 18, 2019 · 7 comments · Fixed by #892

Comments

@kisielm
Copy link

kisielm commented Feb 18, 2019

Is your feature request related to a problem? Please describe

I've tried 'Extra month view weeks' solution proposed here #866 and it have some default behaviour that I would like to turn off. I've added clickable events to extended month view and enabled clicking on the events that are visible in calendar, and when clicking on an event that is out of the scope of current month, I'm moved to next/previous month and there the event is opened.
I prepared an example how does it behaves right now (click on 31st of January):
https://stackblitz.com/edit/angular-qtnlr1

Describe the solution you'd like

I would like to stay on the same calendar page.

Describe your use case for implementing this feature

It would be great to have a configuration option to decide if I should be moved/scrolled to next/previous month when clicking an event that is visible on current calendar page.

Additional context

Working example of described default behaviour
https://stackblitz.com/edit/angular-qtnlr1
image

@mattlewis92
Copy link
Owner

For some reason when I click that stackblitz link it errors out, can you share the edit link instead that looks like https://stackblitz.com/edit/angular-s5woar?file=index.html Thanks!

@kisielm
Copy link
Author

kisielm commented Feb 18, 2019

Thanks for fast response!
This one should work: https://stackblitz.com/edit/angular-qtnlr1
I also updated original post with proper url.

@no-response no-response bot removed the needs reply label Feb 18, 2019
@mattlewis92
Copy link
Owner

Ah I see what's happening, in dayClicked you're changing the viewDate to the day you clicked on, if you remove this line this.viewDate = date; then it behaves as you want it to 😄

@kisielm
Copy link
Author

kisielm commented Feb 18, 2019 via email

@mattlewis92
Copy link
Owner

Ahh, I see your issue, I guess I could change activeDayIsOpen to accept a date as well as a boolean, and then it would use that instead of the viewDate

@mattlewis92
Copy link
Owner

Added in the latest 0.27 beta

npm i angular-calendar@next

Add an activeDay input to the month view and use that to control which day is open instead of the viewDate. Let me know if that works for you 😄

@kisielm
Copy link
Author

kisielm commented Feb 19, 2019

Works like a charm! Thanks a million for adding this feature with lightning speed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants