Extend List View Class only for one doctype

Hi,
i want change/extend some of list view methods. Is it possible to do something like that for only one doctype?

I have this code in doctype_list.js, but after first load of this file, it will replace ListView class in all doctypes:

frappe.views.ListView = class ListView extends frappe.views.ListView {
	before_refresh() {
		super.before_refresh();
		console.log("custom before refresh");
		return Promise.resolve();
	}
};

I know that i can add some custom code through

frappe.listview_settings['doctype']

But this is not enough.

Thank you very much.

1 Like