Hi,
I have a Select field in my parent DocType with two options:
I also have a child table with columns:
c1, c2, c3
I want the column sequence in the child table to change dynamically based on the selected option.
For example:
When Option 1 is selected:
c1 | c2 | c3
When Option 2 is selected:
c2 | c1 | c3
Is it possible to dynamically change/reorder the child table column sequence based on a field value in the parent DocType?
If yes, what would be the recommended Frappe approach for achieving this without modifying the standard framework code?
Thanks.
Hi, this is possible with customization, but dynamically reordering child table columns is not directly supported through a standard Frappe Client Script API.
The child table’s column layout is generally determined by the child DocType field configuration.
If the requirement is only to show different fields depending on the parent Select value, you can use a Client Script with frm.fields_dict['child_table_fieldname'].grid.update_docfield_property() and refresh the grid.
However, if you specifically need to change the order from c1 | c2 | c3 to c2 | c1 | c3, that would require a more customized approach involving the grid layout. I would avoid directly manipulating the DOM because it may break after framework updates.
Could you confirm which Frappe version you’re using and whether you need the columns reordered in the inline grid, the expanded child row form, or both?
That would help determine the safest approach without modifying Frappe core.