Parent Child (or master detail) relationships are a very common structure of data, and sometimes people want to show this information in a single table – where for each row of the parent we also show the details of the children. (In SQL you get this type of presentation using a “group by” clause). Something that looks like this:
In the video below I show the basic steps to help you achieve this.
The first thing you’ll want to have is a REST endpoint that returns this “Tree” structure where we include the children in each parent. If you are working with business objects in Visual Builder, you’ll need to enable the accessor on the relationship between the master and the detail (0:05 in the vide). Keep track of that accessor name, as you’ll use it later in your code in a couple of places. Once you do this, you can pass this accessor name as the “expand” parameter to your REST call and the proper data structure can be returned. Next – store it in an Array in your page.
Now let’s turn to creating the UI.
In the demo I’m using a table, and in one of the columns I’m using a bind-for-each loop (line 8) to iterate over the children of the specific row and show them. Read the complete article here.
For regular information become a member in the Developer Partner Community please register here.