Default filter in list view

By default, when I open items list view I want to show only those products that belong to the group “Products”. I know how to add a filter but I need it to be active every time the list opens, even if the user previously deleted it.

Thanks

If you can customize check this, Listview Filter

Use hooks doctype_list_js to add custom script over item_list.js

@revant_one it works with fields like item_code or item_name but it doesn’t works with item_group, which is the field I need to filter.

Maybe it does not work because it’s a link-type field?

This is my code:

onload: function (listview) {
    frappe.route_options = {"item_group": ["=", "Product"]};
}

`

try Products instead of Product

Add Client Script [Applying To - List]

// FOR CHILD TABLE FIELD
frappe.set_route('List', 'Task', 'List', {
    '<Child Table Doctype>.<child_table_field>':"specify_child_table_field"
    
});
// FOR MAIN DOC FIELD
frappe.set_route('List', 'Task', 'List', {
    'status':""
    
});
// ANOTHER WAY
frappe.listview_settings['Task'] = {
	filters: [["status", "=", "Open"]]
}