Row-specific Select options in Child Table?

Hi,

Is it possible in Frappe to have different Select options per row in a child table?

From what I tested, when I use update_docfield_property("options", ...), it updates the options globally for the entire column (all rows).

Is there any supported way to make each row show its own Select options, or is the only workaround to use a Data field with Autocomplete?

Thanks!

See this:

You can use this code, you need to loop through the table to get the child variable:

frm.set_df_property(frm.doc.tablefield, 'options', [...options], frm.doc, childtablefield, child.name)

Example:

for (let child of frm.doc.childtable) {
	if (x) {
          frm.set_df_property(child.parentfield, 'options', [1, 2, 3], frm.doc.name, 'tablefieldname', child.name)
    } else {
          frm.set_df_property(child.parentfield, 'options', [1, 4, 5], frm.doc.name, 'tablefieldname', child.name)
    }
}
frm.refresh_field("childtable");
1 Like

Solved, Thanks