How to hide/remove the delete button from any child table?

I have tried using custom script. But It doesn’t work.

frm.get_field('support_usersite').grid.cannot_delete_button = true;

Screenshot from 2023-09-28 10-29-53

@Prasant_Pant Try this
cur_frm.fields_dict[‘system_mapping’].grid.wrapper.find(‘.grid-remove-rows’).hide();

2 Likes

Hi @Prasant_Pant,

Please check the syntax.

frappe.ui.form.on('Your DocType', {
    refresh: function(frm) {
       frm.set_df_property('child_table_name', 'cannot_add_rows', true); // Hide add row button
       frm.set_df_property('child_table_name', 'cannot_delete_rows', true); // Hide delete button
       frm.set_df_property('child_table_name', 'cannot_delete_all_rows', true); // Hide delete all button
    }
});

Please set your doctype name and child table name in the script according.

Please check it reference.
https://github.com/search?q=repo%3Afrappe%2Ferpnext%20cannot_add_rows&type=code
https://github.com/search?q=repo%3Afrappe%2Ferpnext+cannot_delete_rows&type=code

I hope this helps.

Thank You!

9 Likes

Thanks man! It works @NCP

it also works. Thanks @Jecintha

hey @NCP,
how to disable the edit button in child table

try it: Remove edit form child table - #4 by NCP

OR use

in_place_edit