Connecting two child tables in one doctype


I am trying to test the following scenario

  1. One doctype has two child tables
  2. Second child table has a field that links to active row on the 1st child table
  3. Everytime I select the row on the 1st table, I refresh the 2nd table

I am thinking to write a custom client script to capture events on the 1st table. The question is what trigger can I use on the 1st table?

One of the business case is as follow

Main doctype is a product; Say T-Shirt
1st table is the product variance, say by color
2nd table is the sizes or cut of the T-Shirt and color

Since Frappe can’t have nested tables; I am thinking of using the scenario above

Greatly appreciate your help…