Need to update child table field options based on the option selected in parent table

  1. In parent doctype given a single option to select the DocType.
  2. After selecting the option in parent DocType need to update in child DocType select options.

How can we do it …??

I have tried in this way

function set_child_table_options(frm, options) {
console.log(“Updating level_value options for child table:”, options);

let child_table = frm.fields_dict.table_13.grid;
if (!child_table) {
    console.error("Child table 'table_13' is not available.");
    return;
}

child_table.get_rows().forEach(function(row) {
    let level_value_field = row.get_field('level_value');
    if (level_value_field) {
        level_value_field.df.options = options.join("\n");
        level_value_field.refresh();
    }
});

frm.refresh_field("table_13");

}

But no use…