Using same child table for the two fields in doctype

I am using a same child table say product review and using the this table in the two fields on the product as a positive review and negative review but on the positive review I want to take the rating also from the user.

I have a rating field in my child table which I want to hide from the negative review but if I hide the rating from the negative review using custom js it also hide it from the positive review table.

I just want to hide the rating column from the child table if the parent field is negative_review

Please tell me if it is possible or is there any work around approach to perfom this

// I have tried this code on refresh 
const table_name = "negative_review"
const column_name = "rating"
 grid =  frm.fields_dict[table_name].grid
    grid.fields_map[column_name].hidden = 1
    grid.visible_columns = undefined;
    grid.setup_visible_columns();
    
    grid.header_row.wrapper.remove();
    delete grid.header_row;
    grid.make_head();

frappe.ui.form.on(‘YourDoctype’, {
refresh: function(frm) {
// Get the value of the parent field
var parentFieldValue = frm.doc.parent_fieldname;

    // Check if the parent field value is 'negative_review'
    if (parentFieldValue === 'negative_review') {
        // Hide the rating field in the child table
        frm.fields_dict['child_table_fieldname'].grid.get_field('rating').toggle(false);
    } else {
        // Show the rating field in the child table
        frm.fields_dict['child_table_fieldname'].grid.get_field('rating').toggle(true);
    }
},
parent_fieldname: function(frm) {
    // Call refresh function when the parent field value changes
    frm.events.refresh(frm);
}

});
try this

Getting error

TypeError: frm.fields_dict['child_table_fieldname'].grid.get_field(...).toggle is not a function

there is no toggle function available

frappe.ui.form.on(‘YourDoctype’, {
refresh: function(frm) {
// Get the value of the parent field
var parentFieldValue = frm.doc.parent_fieldname;

    // Get the child table grid
    var grid = frm.fields_dict['child_table_fieldname'].grid;

    // Get the rating field in the child table
    var ratingField = grid.get_field('rating');

    // Check if the parent field value is 'negative_review'
    if (parentFieldValue === 'negative_review') {
        // Hide the rating field in the child table
        ratingField.df.hidden = 1;
    } else {
        // Show the rating field in the child table
        ratingField.df.hidden = 0;
    }

    // Refresh the child table grid
    grid.refresh();
},
parent_fieldname: function(frm) {
    // Call refresh function when the parent field value changes
    frm.events.refresh(frm);
}

});

Thank you @Prasant_Pant but the this is not working grid field return the blank object so, there is no property like df or toggle

// Get the child table grid
var grid = frm.fields_dict[‘child_table_fieldname’].grid;

// Check if the parent field value is ‘negative_review’
if (parentFieldValue === ‘negative_review’) {
// Hide the rating field in the child table
grid.toggle_display(‘rating’, false); // Hide the rating field
} else {
// Show the rating field in the child table
grid.toggle_display(‘rating’, true); // Show the rating field
}

// Refresh the child table grid
grid.refresh();