How to change set_df_property in Child Table Field

Hello,

I am trying to do the same but instead of making field required, I am making field read only. I tried the method.

cur_frm.get_field(“fields”).grid.toggle_enable(“fieldname”, true);

but got the following error:

Uncaught TypeError: cur_frm.get_field(…).grid.toggle_enable is not a function

I also found the following method :

cur_frm.get_field(“fieldname”).grid.docfields[index].read_only = 1

The above code works and it makes the field read only. But I am not sure that passing the index is right approach to do this. Is their any workaround.

Thanks,
Makarand Bauskar