Skip to content

Commit

Permalink
Make the calendar work in the subform field
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Dec 10, 2016
1 parent 375897a commit 50b83cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions media/system/js/fields/calendar-vanilla.js
Expand Up @@ -1020,11 +1020,16 @@
}
};

/** Init the Calendars on the page */
JoomlaCalendar.init = function (className) {
/**
* Init the Calendars on the page
*
* @param {String} className The field class name (required)
* @param {HTMLElement} container The field container (optional)
*/
JoomlaCalendar.init = function (className, container) {
var elements, i, instance;

elements = document.querySelectorAll(className);
elements = (container || document).querySelectorAll(className);

// Fall back for translation strings
window.JoomlaCalLocale = window.JoomlaCalLocale ? JoomlaCalLocale : {};
Expand Down Expand Up @@ -1065,6 +1070,10 @@
/** Instantiate all the calendar fields when the document is ready */
document.addEventListener("DOMContentLoaded", function() {
JoomlaCalendar.init(".field-calendar");

window.jQuery && jQuery(document).on("subform-row-add", function (event, row) {
JoomlaCalendar.init(".field-calendar", row);
});
});

})(window, document);

0 comments on commit 50b83cf

Please sign in to comment.