You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have registered two modal forms and was getting problems with missing select2 dropdowns. When the last for is rendered by ajax, only the first occurence of the select2 control was baing setup by javascript. Clearing the innerhtml when the modal closes solves this problem.
Alter kb-modal-ajax.js
ModalAjax.prototype.init = function (options) {
this.selector = options.selector || null;
this.initalRequestUrl = options.url;
this.ajaxSubmit = options.ajaxSubmit;
jQuery(this.element).on('show.bs.modal', this.shown.bind(this));
jQuery(this.element).on('hidden.bs.modal', this.closed.bind(this));
};
/**
* Clear inner html when the form closes. This fixes a problem where items with the same id are not
* rendered or have the correct javascript attached.
*/
ModalAjax.prototype.closed = function (event){
jQuery(this.element).find('.modal-body').html('<div class="modal-ajax-loader"></div>');
}
The text was updated successfully, but these errors were encountered:
I have registered two modal forms and was getting problems with missing select2 dropdowns. When the last for is rendered by ajax, only the first occurence of the select2 control was baing setup by javascript. Clearing the innerhtml when the modal closes solves this problem.
Alter kb-modal-ajax.js
The text was updated successfully, but these errors were encountered: