I have created frappe.ui.Dialog
with HTML
field .
After I render html with frappe.render_template
, th dialog opens. I successfully do my action, with button click event etc in jQuery.
BUT, after I close thie Dialog and reopen it again, the button click event are not triggered.
This is a code sample:
frappe.ui.form.on('Quotation', {
'refresh': function (frm, cdt, cdn) {
},
'quick_quotation_btn': function (frm, cdt, cdn) {
let doc = locals[cdt][cdn];
let rendered_template = frappe.render_template("paste_quote", {'data': 'ds'});
/*
Init Dialog
*/
let dialog = new frappe.ui.Dialog({
title: __('Quick Quote'),
fields: [
{
fieldtype: 'HTML',
fieldname: 'alt_item_name',
label: __(''),
reqd: false,
description: __(""),
options: rendered_template
}
]
});
dialog.show();
dialog.$wrapper.find('.modal-dialog').css("width", "50%");
/*
This button click event is in rendered_template html
*/
$("#generate_table").click(function () {
console.log('OK')
}
}
}
});