[Enhancement] Reports > Clear Grid Filters

In some reports, where the result set is large, user uses grid filters.

There’s no way to clear those grid filters currently.

We propose to add a button for the same. We can add a button [Clear Grid Filters] in either “Inner Toolbar” or inside Menu.

What seems more appropriate? Or any alternate suggestions?

Regards,
Vamyip

Hi There,

We are pursuiing a way to clear the filter on page load/refresh as well.

Is there anyone can point me in the right direction on how to implement this?

Can paste below snippet in any of custom JS files that you include inside your app. This is for v10 only.

frappe.views.QueryReport = frappe.views.QueryReport.extend({
    make_toolbar: function() {
        this._super();
        var me = this;
        this.page.add_action_icon('fa fa-eraser',function(){
                me.clear_grid_filters();
        });
    },
	clear_grid_filters: function () {
		$('.slick-headerrow-column').children().val('');
		// empty out all column filters within the columnFilters object & refresh dataview
		for (var columnId in frappe.query_report.columnFilters) {
			frappe.query_report.columnFilters[columnId] = "";
		}
		frappe.query_report.dataView.refresh();
	}
});

Can this run on reports generated using report builder?

Nope. Query Reports and Script Reports only.