Hide add row button after 7 rows

Hello,
This code worked perfectly but i want to hide add row button after 7 rows and i want to set 50 word limit on each row.

can anyone help me,

Thank you.

frappe.ui.form.on('Listing Properties', {
onload: function(frm) {

        frm.get_field('key_features').grid.cannot_add_rows = true;
}
});

@falah123 Please check this code

frappe.ui.form.on('Write your child table name', {
{child_table_fieldname_of_your_parent_doctype}_add: function(frm) {
       if (frm.doc.child_table_fieldname.length > 6) {
           frm.get_field('key_features').grid.cannot_add_rows = true;
       } else {
          rm.get_field('key_features').grid.cannot_add_rows = false;
       }
},
{child_table_fieldname_of_your_parent_doctype}_remove: function(frm) {
       if (frm.doc.child_table_fieldname.length > 6) {
           frm.get_field('key_features').grid.cannot_add_rows = true;
       } else {
          rm.get_field('key_features').grid.cannot_add_rows = false;
       }
}
});

child table will not come in the script, the parent doctype will come. please check the example.