[Solved] Removing a row in Child Table based on Table idx

@kickapoo Thanks for your explanation, I have found another way to remove the rows.
below the reference to the thread in case you want to remove multiple rows based on some criteria inside the child table.

for the Payment Entry doctype it is a bit more complicated because the server side scripts running on refresh for the references so I had to add some script on the server side.

On top of that I added a validate SUM on the client side for the field paid_amount so the user does not need to calculate the paid amount.

Python Server

    def clear_invoices(self):
        self.set("references", self.get("references", {"del_all": ["not in", [0, None, ""]]}))

        frappe.db.sql("""delete from `tabPayment Entry Reference` 
            where parent = %s and del_all = 0""", self.name)    

JS Server

    
    del_iv: function(frm) {
        return frappe.call({
            method: "clear_invoices",
            doc: frm.doc,
            callback: function(r, rt) {
                frm.refresh_fields();
            }
        });
    },
```

JS Client

```
frappe.ui.form.on("Payment Entry", "validate", function(frm, cdt, cdn) {
    // code for calculate total and set on parent field.
    rf = 0;
    $.each(frm.doc.references || [], function(i, d) {
        rf += flt(d.allocated_amount);
    });
    frm.set_value("paid_amount", rf);
});
```