Master and slave datatables (dependent)

I personally would not use this kind of sync.
instead I would open separate popup to edit lines and close it on save/cancel.