Client Script to apply Filter on List View

Hi there,

is there any way to create a client script to apply a filter on a list view, when the list is loaded?

I got this but even there should be a result I always get a empty list:

frappe.listview_settings['Timesheet'] = {
    onload: function(listview) {
        listview.set_filter('workflow_state', 'Aproved');
    }
};

It would be really nice to get something like that working.
Thanks

Is your workflow state “aproved” or “approved”

Also try this

frappe.listview_settings['Timesheet'] = {
    onload : function(listview) {
        frappe.route_options = {
            "workflow_state": "Approved"
          };
        listview.refresh();
    }
};
2 Likes

@Yamen_Zakhour thank you very much that worked like a charm.