Hi,
How would i create button before menu
thanks in advance:pray:
hello,
this link should help you i guess
https://frappe.io/docs/user/en/guides/app-development/adding-custom-button-to-form#targetText=To%20create%20a%20custom%20button,a%20button%20to%20your%20form
Hey,
Thanks for response, But i donโt want i want out side or purchase order when purchase order list will show that from that time should show the button like (New, Refresh,Menu)โฆ
did you find a way to do that?
need to do it in my app
@justmejust
create a file with name โ[doctype_name]_list.jsโ in your doctype folder and then you can adapt this code to get the desired behaviour
frappe.listview_settings["[doctype_name]"] = {
onload: function(listview) {
this.add_button([button_name], "default", function() { /*actions*/ })
},
add_button(name, type, action, wrapper_class=".page-actions") {
const button = document.createElement("button");
button.classList.add("btn", "btn-" + type, "btn-sm", "ml-2");
button.innerHTML = name;
button.onclick = action;
document.querySelector(wrapper_class).prepend(button);
},
};
Its not working.
frappe.listview_settings['MyDocType'] = {
onload(listview) {
listview.page.add_button(__('Say hello), function () {
frappe.msgprint('hello');
}, {});
},
}