[SOLVED] Can't trigger child table _add or _remove events

According to this resource : https://frappe.github.io/frappe/user/fr/guides/app-development/trigger-event-on-deletion-of-grid-row

But it seems not to work:

My DocType Field:

And my js code on the DocType:

booked_add: function(frm){
  console.log("Hey dude, you added something to booked !!!")
},

Where is no message, or any error indicator of that I might making wrong.

Any ideas?

Checkout your browser’s console! It is where you are sending it.

@yashodhan Thank for the answer but my noodness lvl passed console.log prints many years ago.

1 Like

The problem is that in docs is not clear stated that the handling should be on child table.

A simplified example

Assume that you have a DocType: ParentDoc with a table field to ChildDoc with field name achild

In order to trigger the event

  frappe.ui.form.on('ParentDoc', {
     // that ever here  
 })
  
  frappe.ui.form.on('ChildDoc', {
    achild_add: function(frm) {
      // adding a row ... or on btn add row
   },
   achild_remove: function(frm) {
      // removing a row ... or on btn delete 
   }
  });
3 Likes

@kickapoo will you able to contribute this to documentation? Thanks

Send PR for:
https://github.com/frappe/frappe/blob/develop/frappe/docs/user/fr/guides/app-development/trigger-event-on-deletion-of-grid-row.md