Joomla! 3.7 RC 4 - create the calendar dynamically (e.g. with help of Javascript), initialize the calendar after pasting this calendar to html:
JoomlaCalendar.init(".field-calendar");
Works as expected - calendar of dynamically created item is initialized and it works.
Joomla! 3.7 Stable
Create the calendar dynamically (e.g. with help of Javascript), initialize the calendar after pasting this calendar to html:
JoomlaCalendar.init(".field-calendar");
Does not work:
calendar.min.js:45 Uncaught TypeError: Cannot create property '_joomlaCalendar' on string '.field-calendar'
at new JoomlaCalendar (calendar.min.js:45)
at Function.JoomlaCalendar.init (calendar.min.js:1102)
JoomlaCalendar @ calendar.min.js:45
JoomlaCalendar.init @ calendar.min.js:1102
You can initialize calendar for newly dynamically created items on the site like in Joomla! 3.7 RC4
Works in Joomla! 3.7 RC4, doesn't work in Joomla! 3.7 Stable
Joomla! 3.7 RC4 vs. Joomla! 3.7 Stable
PHP7
Labels |
Added:
?
|
Category | ⇒ | JavaScript |
Can be closed as it is not an issue but change between RC4 and Stable
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-04-26 12:22:20 |
Closed_By | ⇒ | PhocaCz |
..., this issue can be closed but developers should get informed about the change (I hope this topic can help when somebody runs into the same problem).
Thanks for bring this up , i have missed this change too,
yes i see that in J3.7 we need to use
JoomlaCalendar.init(element);
instead of in the J3.7 RCs
JoomlaCalendar.init(selector);
Ok, seems like I found the problem.
media\system\js\fields\calendar.min.js
Init function parameter changed, from className to element
FROM
@param {String} className The field class name (required)
TO
@param {Node} element The element node
So instead of initializing with the class name:
JoomlaCalendar.init(".field-calendar");
in version RC4
it should be initialized with element:
in Stable
I hope, there will be no more changes regarding the function parameter. If no, this issue can be closed but developers should get informed about the change (I hope this topic can help when somebody runs into the same problem).
Jan