On change event in filter list view

Hi all,
How can adding “on change” trigger on a filter field in list view page?

There is no direct event hook, but you can use the onload hook of listview and add your event handler. Maybe we should add this hook in the standard listview.

2 Likes

thanks @netchampfaris
Have any Example plz?

In your_doctype_list.js

frappe.listview_settings['Your DocType'] = {
  onload(listview) {
    const handler = listview.filter_area.filter_list.on_change.bind(listview.filter_area.filter_list);
    listview.filter_area.filter_list.on_change = () => {
      // your custom code
      handler();
    }
  }
}

1 Like

Thanks @netchampfaris
I already tried this solution, but I have a undefiend error with “filter_area”

Use

const handler = listview.filter_area.filter_list.on_change.bind(listview.filter_area.filter_list);