Refresh Whole Child Table

cur.frm.refresh("{{child_table}}") is not working, i want to refresh all data in child table.

did u find any solution?

If u want to refresh specific child table, u may use cur_frm.refresh_field("child_table_name"). If entire document, u can use cur_frm.refresh().

thanks, but this refresh command isn’t working :frowning:

May I see ur code and also which doctype child table u want to refresh?

@AMS_Fauzi
Child table i am trying to refresh is that of “salary details” in the field “deductions” in Salary Slip. I have tried using both cur_frm.refresh_field(‘deductions’) and cur_frm.refresh_field(‘salary_details’) but it doesnt refresh.

The code is copied below. Kindly advise:

frappe.ui.form.on(‘Salary Slip’, {
refresh: function(frm)
{
frappe.call({
method:“frappe.client.get_value”,
async:false,
args:{
doctype:‘Lunch Mess Option’,
filters:{
employee:cur_frm.doc.employee
},
fieldname:‘opt_in’
},callback:function(r){
console.log(r.message);
if(r.message !== undefined){
cur_frm.set_value(‘opt_in’,r.message.opt_in);
cur_frm.refresh_field(‘opt_in’);
cur_frm.refresh_field(‘deductions’);
}
}
});
}});

I needed to reorder the Employee list child table in the Training Event docType. This post and and this one helped me.

frappe.ui.form.on('Training Event', {
	refresh(frm) {
        var idx = 1;
        frm.doc.employees.sort(function(a,b){
          if (a.employee_name < b.employee_name){ return -1 }
          else if ( a.employee_name > b.employee_name){ return 1 }
          return 1;
        });
        
        frm.doc.employees.map(function(item){
          item.idx = idx++;
        });	
	    
	    frm.refresh_field("employees");
	}
        
})