I am looking for a way to customize the grid view to show only one month at a time but also have the ability to swap months, similar to the calendar view. I have an idea of how to accomplish this but am having some issues creating the JS myself. Here is how I think it can be accomplished if someone can help determine the correct coding:
Set grid view to “group by month” and set number of months to display to “12”.
In CSS, (or a JS equivalent), set Grid Groups to the following:
.eapp-events-calendar-grid-group:nth-of-type(n+2) {
display: none !important;
}
Where I am running into issues - Create a button element with text “Next Month” to append to .eapp-events-calendar-date-element-item that, on click, will hide current (December for example) .eapp-events-calendar-grid-group and display the subsequent (January) .eapp-events-calendar-grid-group.
If possible, it would also be great to have a second button with text “Previous Month” to prepend to .eapp-events-calendar-date-element-item that would do the reverse function (hide current and display previous).
Any help would be greatly appreciated as this would drastically improve the user experience of the Events Calendar module for my organization!
Hi there and welcome to the Community, @DustinVance
Right now, it’s impossible to customize the widget this way, but we have a Wishlist request for the Carousel layout, that should be the right option for this - Carousel Layout
Feel free to upvote this idea to not miss any updates
Hey Max, thanks for the follow-up! I was actually able to accomplish what I was trying to do with a little experimentation and some JS from the custom filters post, thought it isn’t completely perfect yet.
I do have a follow-up question though, if you are able to help. Is there some javascript code to reset all of the filter for grid view?
Thanks for the follow-up. Here is a link to the embedded calendar: Test Page — CAP
As you will see, I have the “Previous Month” & “Next Month” buttons working. However, if there is a filter combination that yields no events, the error message displays, and even after clearing the filters, no events populate.
I managed to create a new button called “Reset Filters”, and this button will reset the month back to the current month and show it. But if possible, I would love this button to also reset any current filters to default so someone doesn’t have to manually remove them. Hope that makes sense, and happy to provide more info if needed.
Just putting the solution here to help anyone that would like it until we get a similar feature natively! Full disclaimer, I am not super proficient Javascript coder, so if anyone has a way to improve this code and its overall functionality, please feel free to!
Important Issues to Note when Implementing
The JS only runs outside of the editor, so when in the editor, all events will be hidden due to the CSS. I haven’t figured out how to only have the CSS run on the calendar embed, so I manually “turn off” the display:none CSS when editing to view the calendar items in the editor, and then “turn it back on” when publishing to make the code work when live.
This code doesn’t play nicely with the date filter, so I have the date filter hidden using CSS.
As mentioned above, if there is a combo of filters that produces no result, it will cause the code to break temporarily. To remedy this, I created a “Reset Filters” button that will reset the calendar back to the current month and turn off all filters.
Layout Settings
Layout: Grid View
Group Events By: Month
Months to Display: 120 (this can be any number. I just used a large number to get it to show far into the future.)
Custom Code for a Click-Through Single Month View in Grid View: