Triggering an action when a child table row is selected

I am trying to trigger some events when a row in a child table is selected. However, it triggers when the row is opened as a form in a table field

frappe.ui.form.on('Despatch Plan', {
    sales_orders_on_form_rendered: function(doc, cdt, cdn) {    
        frappe.msgprint("On click of sales order item row");   
    }
});

When we select a row in the child table, I would like an event to be triggered

Hi @Dharanipathi,

Please apply the client script for it.
We did apply on Sales Order DocType. so please check the syntax.

frappe.ui.form.on('Sales Order', {
    refresh: function(frm) {
        frm.fields_dict.items.grid.wrapper.on('click', '.grid-row', function(event) {
            // Trigger your desired event here
            frappe.msgprint("Clicked the Sales Order Row.");
        });
    }
});

Please set your doctype, fieldname, and child table field name.
I think your problem will solve.

Thank You!

4 Likes

Thank you, It’s working :upside_down_face: