How we can trigger the button of current row

This is always opening the first row, how do we open the current row?

frappe.ui.form.on(“Purchase Order Item”, “item_code”,function(frm,cdt, cdn)


Please Suggest me


frappe.ui.form.on(‘Purchase Order Item’, ‘item_code’,function(frm,cdt, cdn)
var cur_grid =frm.get_field(‘items’).grid;
var cur_doc = locals[cdt][cdn];
var cur_row = cur_grid.get_row(;

thank You sir @szufisher

it’s working fine