Add Button in Child Table

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

2 Likes

let btn = document.createElement(“button”)
btn.innerText = “abc”
frm.fields_dict.items.grid.wrapper.find(".grid-upload").removeClass(“hide”).parent().append(btn)

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';
	frm.fields_dict.items.grid.wrapper.find('.grid-upload').removeClass('hide').parent().append(btn);
	btn.addEventListener("click", function(){
	});
	}	
})

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

3 Likes