ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Query report action when filters change

Is there any way to append an action when frappe.query_reports is refreshed or submited?

  • On load function not take effect when filters changed
    onload: (report) => {}

  • On change function for each filter can not verify if the other mandatory fields have already been filled
    on_change: function() {}

Then you should check whether the fields are set, in the on_change of filters

Yes, I could do that, but it stop the initial event when I define on_change event for each filter.

So, the query report never show the slickgrid, always show the message “Please set filters”

Any idea?

Hey @joepa37! I faced your problem too and solved it simply by adding a refresh command. You can call the on_change method like this - on_change: function(query_report) where query report is the QueryReport object. After your code, you should give query_report.refresh() and that generates the report again. You can check: https://github.com/frappe/frappe/blob/develop/frappe/public/js/frappe/views/reports/query_report.js for further functions available for query_report.