How to create "toggle grid view button" in Doctype listview

Frappe “file>file manager” in file manager frappe create toggle grid view button for show the attach image in toggle view , that same button i’m trying to create in doctype listview for save data/records show in toggle view.
also i trying the override frappe listview.js that file call in but not solve,
anyone can do this.