Problem with a master/detail using form/grid

I have a master/detail. The master is a form and the detail is a grid. In the form I add products and with ajax I save on the database and I refresh the grid where I can see the records. When I add products, the final price (in the master) is updated perfectly. Now, in the grid I have a link to delete records one by one. The delete is working perfect, but the only one problem is the final price is not updated when I delete one product. I have tried many ways to resolve but I can’t do it

I attach a image and explain the situation: Step 1: I delete one product (link on the grid). Step 2: the price is not updated.

Maybe is simple but I have spent a lot of time.
Thanks in advance.

example.png

You can do it. same way you update your master when insert a new record.
Only that in the grid you must set in other event your update, in this case in event onAfterDelete.

Thanks Alvagar.
But the current delete is an ajax event of the field of grid detail; so there is not AfterDelete. Or you are taking the afterDelete event in a master form?
But, I changed the grid of detail into form and now it’s working. I don’t remember why did I use a grid and not a form. Anyway… thanks for your help. O will try your indications.

I allways use form type grid for my Master-Detail. The Forms Grid have the event ONafterDelete.