Dear All,
I want to apply a refresh or onload trigger on the child data table.
frappe.ui.form.on(“KRA Details”, {
refresh: function(frm,cdt, cdn){
console.log("Working..")
}
});
but it is not working…
Any solution…?
Regards,
Vishakha
Dear All,
I want to apply a refresh or onload trigger on the child data table.
frappe.ui.form.on(“KRA Details”, {
refresh: function(frm,cdt, cdn){
console.log("Working..")
}
});
but it is not working…
Any solution…?
Regards,
Vishakha
Try this:
Suppose your child table field name is items.
items_on_form_rendered: function(frm, cdt, cdn){
your script
}
Not Working…
Where you are using this?
Use it on the parent form.
but i need calculation from child table
Can you provide an example of a working table, please.
I have a child table “KRA Details” which have score field ,what i want is simply add scores from all rows of that table and set it to the parent table’s field “total Score”.
It is working but by using onchang of score,and i want it on refresh or onload.
frappe.ui.form.on(“KRA Details”, {
kra_details_on_form_rendered: function(frm,cdt, cdn){
console.log("Executing..")
}
}):
But it is not working…
KRA details is your child table you are using on_form_rendered
event on child table. Use it on parent instead.
frappe.ui.form.on(“Your Parent Doctype”, {
kra_details_on_form_rendered: function(frm,cdt, cdn){
console.log("Executing..")
}
}):
Still not working…is there any other event for child table?
frappe.ui.form.on(“KRA”, {
kra_details_on_form_rendered : function(frm,cdt, cdn){
console.log("Executing..")
}
});
May be code is not reflecting.
Try
bench build && bench clear-cache
Then reload the doc.
Noo,still the same can you suggest me any other trigger
Hi ,
Try this
Calculate total score on form level trigger and set value of total score field on form
E.g:
validate:function(frm){
var total_score = 0
$.each(frm.doc.child_table_name, function(idx, row){
total = total + row.score
})
frm.set_value(“field_name”,total_score)
}