Topic: Calendar ignoring javascript instance
Macjohn free asked 3 years ago
Expected behavior Ability to instantiate calendar via javascript
Actual behavior No calendar via javascript. Canlendar only showing if I use data-mdb attributes.
Resources (screenshots, code snippets etc.)
This works:
<div
class='calendar'
id='calendar'
data-mdb-monday-first='true'
></div>
This does not work.
<div id='calendar'></div>
with this javascript:
const calendarElement = document.getElementById('calendar');
const instance = Calendar.getInstance(calendarElement, {
mondayFirst: true,
});
instance.next();
As soon as I add the class 'calendar' it works, but it is ignoring the javascript options. The javascript is loaded, and it is loaded after mdb. Can you help?
Grzegorz Bujański staff answered 3 years ago
Thanks for reporting a bug. We'll fix it. As a workaround, use this code:
<div id='calendar'></div>
const calendarElement = document.getElementById('calendar');
calendarElement.classList.add('calendar');
const instance = new Calendar(calendarElement, {
mondayFirst: true;
});
btgdev priority commented 1 year ago
Hello! Has there been a resolution for this? Your workaround works fine, and I'm fine with using the workaround, but I wanted to make sure I wasn't otherwise causing a problem by continuing to use the workaround.
Kamila Pieńkowska staff commented 1 year ago
We did not change that. This method is still valid.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: 3.2.0
- Device: Any
- Browser: Any
- OS: Any
- Provided sample code: No
- Provided link: No