Rename Child table button as Add Row to Add Service

Dear Community,

I had one Dotype name Service Request.

in this Doctype i had Child table name as Select Services field name as table_lepd.


Table


Here I need to remane this button as “Add Row” to “Add Service”

i tried this code but it not works

frappe.ui.form.on('Service Request', {
    refresh: function(frm) {
        // Renaming the "Add Row" button to "Add Service" in the table_lepd child table
        frm.fields_dict['table_lepd'].grid.get_field('idx').grid_buttons.find('.grid-add-row').text('Add Service');
    }
});

Kindly please help to solve the issue.

Hi @Rizwaan,

Please add this line:

$('button.grid-add-row').text("Add Service");

Then reload Ctrl+Shift+R and check it.

Output:

I tried on the sales invoice form.

3 Likes
frappe.ui.form.on('Service Request', {
    refresh: function(frm) {
        // Renaming the "Add Row" button to "Add Service" specifically for the table_lepd child table
        frm.fields_dict['table_lepd'].grid.get_field('idx').grid_buttons.find('.grid-add-row').text('Add Service');

        // Ensure any other "Add Row" button with the class grid-add-row is also renamed (if necessary)
        $('button.grid-add-row').text("Add Service");
    }
});

shall i miss something?

remove your line

Thanks Its works