child table field readonly

I have a child table and I want a specific field to be editable in desk mode and only readable in portal (web form) mode.
I used the following code, but it doesn’t apply automatically when a row is added, it only applies in the console after adding the row and running the code, which is not suitable.

I would appreciate your guidance.

frappe.web_form.fields_dict[‘child_table_name’].grid.grid_rows.forEach((row) => {
row.on_grid_fields_dict[‘field_name’].$input.prop(‘readonly’, true);