Hello everyone,
In the employee doctype, there is a field “Sub-department”. The type is “Select”. Options are given by the client script. Now, I want to add this field to the listview filter. So I add like this.
the client sciprt for this is:
frappe.listview_settings[‘Employee’] = {
onload: function(listview) {
if(listview.page.fields_dict.sub_department){
let options = [“”];
let records = frappe.db.get_list('Department', {
filters : [['parent_department', 'not in', ['', 'All Departments']]],
fields : ['name']
}).then(res=>{
for(let i=0; i<res.length; i++){
options.push(res[i].name);
}
let sub_department_filter = listview.page.fields_dict.sub_department;
sub_department_filter.df.options = options;
sub_department_filter.refresh();
});
}
},
};
But I want it in the filter button:
Here, no options are visible.
can anyone help me with this?