Custom Button on Main Page(List Page)

Any idea how to add custom button on list page of a doctype.

I want to disable this new button and want to add a custom button doing the same work as ‘New’ via custom script.

Something like this:"Hello",new);

Any help ??

Hi @nikzz,

as far as I understood, adding scripts to the list view cannot be done from the UI (custom script). You will have to check the doctype_list.js file in the doctype folder. This certainly supports adding items to the menu, buttons seem to be not supported. To disable new, you can use the same script and add the hidden class to the button…

frappe.listview_settings['<doctype>'] = {
	colwidths: {"subject": 6},
	onload: function(listview) {"Set as Open"), function() {
			listview.call_for_selected_items(method, {"status": "Open"});
		});"Set as Closed"), function() {
			listview.call_for_selected_items(method, {"status": "Closed"});
        /* // does not work'Hello'), function() {
            frappe.msgprint("Hello World");

Exchange with your doctype…

Hope this helps.

1 Like

And what about changing the height and width of fileds.

Like content of the field lead stage is more and it doesn’t shows completely untill you hover on it. So is that possible via custom script ie, changing the flex and height of fields ??

Hi @nikzz,

to some degree this can be configured directly in the doctype: expand the field you would like to resize and set width:

The value is of bootstrap logic :wink: The total should not exceed 12, make sure to define the other fields as well.

I am talking about fields present on list page (main page)

Yes, that’s the configuration… See also “in list view”