How to trigger code when user clicks on the button in Child Table?

I have added a button to Child Table.

Now I want to trigger Client Script when user clicks on the button.
How can I do that?

And how can we get all the values of the row whose button is clicked in Client Script?


@yogeshvachhani I’m not sure if what I can provide you with will work or not. If you would like to give it a try then, post the name of the main form doctype, a screenshot of the main form and a screenshot of your child table.

@yogeshvachhani You’re looking for form_render: Form Scripts

@tmatteson Thanks for the link. I have already checked this documentation. In my case the Add, Remove, etc. table related events will not suffice.

There is not support for triggering Client Script when a button in the Child Table is clicked.


That was not clear from your initial post. "the button’ means the expand button, and the form_render child table trigger does exactly that. What you need isn’t that complicated:

frappe.ui.form.on('Child DocType', {
    fieldname_of_button: (frm, cdt, cdn) => {
          console.log('I clicked the button')