Create a Tree grid

I'm trying to create a tree grid using 2 different tables (X and Y).
I found a video that explains who add more level of data grid and expand information per row, but I have some problems and the application doesn't work.
create an empty page;
add a data grid, and select data (X);
in Event - Load add parameters, select $expand and as value wrtite the name of the column (A) that is the link between the 2 tables
edit template, add a new data grid and set data=${data.A}.
At this point I don't know where to insert the second table and how to set column B in Y = column A in X.
Can you help me?
Thanks a lot! Michela