How to add a custom button in the list view

Hello guys

I need to add a button in the sales invoice list view and when clicking that according to one field the list view wants to show in ascending or
in descending order.

Is there any option? Please help me with this

Hello @jinsy

I’m not too sure about the ordering of the list view, but I do know how to add a button to the list view:

Create a custom script for the Doctype, and select List View.

In the script editor, add these lines of code

function ButtonFunction(listview) {
frappe.listview_settings['Your DocType Name'] = {
    refresh: function(listview) {"Button Name", function() {

@EugeneP Thank you .I will try