Add "afterRender" callback for modal forms

This commit is contained in:
Oliver Walters 2021-08-24 22:05:00 +10:00
parent 1360b1592d
commit d87ab0033a

View File

@ -258,6 +258,8 @@ function constructForm(url, options) {
constructFormBody({}, options); constructFormBody({}, options);
} }
options.fields = options.fields || {};
// Save the URL // Save the URL
options.url = url; options.url = url;
@ -517,6 +519,11 @@ function constructFormBody(fields, options) {
initializeGroups(fields, options); initializeGroups(fields, options);
if (options.afterRender) {
// Custom callback function after form rendering
options.afterRender(fields, options);
}
// Scroll to the top // Scroll to the top
$(options.modal).find('.modal-form-content-wrapper').scrollTop(0); $(options.modal).find('.modal-form-content-wrapper').scrollTop(0);
} }