Add Button in Child Table

I want to add button in child table like upload and download.


let btn = document.createElement(“button”)
btn.innerText = “abc”

items is child table name
you can delete removeClass(“hide”) if download & upload btn alread existed.

Hii @magic-overflow

I want to add button not want to hide it.

I don’t think my code hide anything.

Ok, my code might not understandable. Hope other has a better one.

frappe.ui.form.on("Sales Invoice", {
	onload: function (frm, cdt, cdn) {
	let btn = document.createElement('a');
	btn.innerText = 'Refresh';
	btn.className = 'grid-upload btn btn-xs btn-default';
	btn.addEventListener("click", function(){

Thanks for hint @magic-overflow :grinning:. This is what I’m looking for.


There (now at least) is a more elegant solution:

frm.fields_dict["my_table"].grid.add_custom_button(__('My Label'), function() {});


Which event is suitable for this? I use refresh event and sometimes my buttons doubled, tripelled :slight_smile:

You can also apply styling to your custom button How to add a custom button on child table - #4 by sanjay

1 Like

I use the refresh event and haven’t had that problem, so far.
What Frappe Version are you on?
Have you tried onload instead?