mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Provide an after_render callback
- User callback after the form data are rendered
This commit is contained in:
parent
57645486cc
commit
0cc2e71843
@ -401,6 +401,10 @@ function handleModalForm(url, options) {
|
|||||||
else {
|
else {
|
||||||
if (response.html_form) {
|
if (response.html_form) {
|
||||||
injectModalForm(modal, response.html_form);
|
injectModalForm(modal, response.html_form);
|
||||||
|
|
||||||
|
if (options.after_render) {
|
||||||
|
options.after_render(modal, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(modal).modal('hide');
|
$(modal).modal('hide');
|
||||||
@ -443,6 +447,7 @@ function launchModalForm(url, options = {}) {
|
|||||||
* submit_text - Text for the submit button (default = 'Submit')
|
* submit_text - Text for the submit button (default = 'Submit')
|
||||||
* close_text - Text for the close button (default = 'Close')
|
* close_text - Text for the close button (default = 'Close')
|
||||||
* no_post - If true, only display form data, hide submit button, and disallow POST
|
* no_post - If true, only display form data, hide submit button, and disallow POST
|
||||||
|
* after_render - Callback function to run after form is rendered
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var modal = options.modal || '#modal-form';
|
var modal = options.modal || '#modal-form';
|
||||||
@ -475,6 +480,10 @@ function launchModalForm(url, options = {}) {
|
|||||||
if (response.html_form) {
|
if (response.html_form) {
|
||||||
injectModalForm(modal, response.html_form);
|
injectModalForm(modal, response.html_form);
|
||||||
|
|
||||||
|
if (options.after_render) {
|
||||||
|
options.after_render(modal, response);
|
||||||
|
}
|
||||||
|
|
||||||
if (options.no_post) {
|
if (options.no_post) {
|
||||||
modalShowSubmitButton(modal, false);
|
modalShowSubmitButton(modal, false);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user