Child Table dynamic select field

I us following syntax but it doesn’t worked
1.frappe.utils.filter_dict(frm.fields_dict[“readings”].grid.docfields, {“fieldname”: “parameter_value”})[0].options = r.message;
2.var df=frappe.meta.get_docfield(‘Quality Inspection Reading’,‘parameter_value’,frm.doc.name);
df.options=r.message;

2 Likes

I have the same problem

i try this but it doesn’t worked for me, after version-13 stable update it’s doesn’t working

frm.fields_dict.readings.grid.update_docfield_property(
‘parameter_value’,
‘options’,
[‘’].concat(r.message)
);

1 Like

frappe was changing upper function prototype, but it seems you provide reliable solution @ajay374-J thanks for it

editing for more clarity

image

frm.fields_dict.child_table_name.grid.update_docfield_property(
“field_name”,
“options”,
[“”].concat([“val 1”, “val 2”, “val 3”])
);

It works and change the field_name over all the child table; If i want the change only for the current row
upon certain condition??

1 Like

use below code it works for me

frappe.utils.filter_dict(cur_frm.fields_dict[“childtablename”].grid.grid_rows_by_docname[cdn].docfields, { “fieldname”: “fieldname” })[0].options = bindlisthere;
cur_frm.refresh();

1 Like

did u find solution for this, pls?

I had the same issue, i wanted to dynamically set the options for select field in my childtable.
Here is how i did it,

frappe.ui.form.on("Child Table Doctype",{

            field_in_table(frm){

                // 1. get the row that is being added or modified

                let row = frappe.get_doc(cdt,cdn)



                // 2. get the docfield metadata object, this way we can modify the `options` property of the docfield

                let df = frappe.meta.get_docfield("Child Table Doctype","child_table_field_name",row.name)

                

                // 3. set the options field with an array of options that you want

                df.options = ["your","options","will","go","here"]

                

                // 4. refresh the row to see the changes

                frm.fields_dict["child table name in parent doctype"].grid.refresh_row(row.name)

            }

        })

Hope this helps.