Why no remove_child() js function?

Why is there an add_child() js method but no remove_child() method?

I could remove elements from cur_frm.doc.child_table directly, but I’m not sure if this is a safe way to do it. What is the correct way to remove child records?

You can do a remove on the grid_row object attached to a grid.

Example:

cur_frm.fields_dict[table_fieldname].grid.grid_rows[row_index].remove();

1 Like

Thank you! That appears to work as expected.

Should the given code be wrapped into a new method called “remove_child”? It’s quite unfortunate from an API usability/consistency perspective to have “add_child” without “remove_child”.

2 Likes