Child table bulk upload trigger

Hello, community,

How can I trigger changing on child table when uploading bulk data to it using bulk edit!

I want to have an action after Upload data, this is my code I tried to trigger test_code changing
this is working in normal add row but using upload bulk not working

frappe.ui.form.on('Lab Prescription', {
	test_code: function(frm, cdt, cdn) {
		var row = locals[cdt][cdn];
		row.test_comment = 'blah blah';
    	cur_frm.refresh_fields(["test_comment"]);
	}
});

and try this also:

frappe.ui.form.on("Lab Prescription", "test_code", function(frm, cdt, cdn){
		var row = locals[cdt][cdn];
		if(row.test_code){
			console.log('hello');
			row.test_comment = 'blah blah';
	    	cur_frm.refresh_fields(["test_comment"]);
    	}
});

have you tried event onload or refresh?

I can’t find child table as your image to test.
I’m on v10.

You can get Bulk Download and Upload for child table by allowing Bulk Edit

you can find it in child table field of the doctype

I tried onload or refresh, but not working

When upload complete, it just refresh child table fieldname and not trigger any event. Normally when a child row added, it trigger event child fieldname_add.

1 Like

frappe/frappe/blob/8ea8027093a63a1bb6909719a586bf1d57e18834/frappe/public/js/frappe/form/grid.js#L628

in line 628:
me.frm.script_manager.trigger(me.df.fieldname+“_upload_complete”, me.doctype, me.name);

frappe.ui.form.on(“Salary Detail”,{
items_upload_complete: function(frm) {
console.log(“complete”);
}
});

// items is child fieldname in parent doctype

2 Likes

Thanks for reply, I think I have no choice else, I have already make my customization on frappe

1 Like

Did you ever find the answer to this one?
I need this too for adding rows in bulk… currently doing it row by row is too inefficient.
Uploading is fast but it doesn’t trigger our code to retrieve / calculate row data for each row inserted.

added this code on line 628
frappe/frappe/blob/8ea8027093a63a1bb6909719a586bf1d57e18834/frappe/public/js/frappe/form/grid.js#L628

me.frm.script_manager.rigger(me.df.fieldname+“_upload_complete”, me.doctype, me.df.name);

and use this in custom script

frappe.ui.form.on(“CHILD TABLE NAME”,{
FieldNameInParent_upload_complete: function(frm) {
console.log(“complete”);
}
});

it working thanks magic-overflow

1 Like

Any solution for this without changing frappe code ?