[QUESTION] Adding function to button on Query Report

Is there a way to add an action to a button that’s been added on a query report.

I have customized my report to have a button using the following code (In my report_name.js file):

{
“fieldname”:“myCoolButton”,
“label”: __(“Select Supplier”),
“fieldtype”: “Button”,
“options”: “”,
“default”: “”
}

I can’t seem to find a way to attach a function to it that gets called when it is clicked. cur_frm doesn’t exist in Query Reports and I can’t use form.ui.on() because there is not really a doctype associated (this isn’t a form). I couldn’t see anything in frappe.query_report that makes sense.

This is a tough one, but anyone have suggestions?

Don’t add the button to filters, see this:

1 Like