Data grid and multiple values association

0
hello, i have one associaton *-* and when i show in datagrid the associated values is all displayed in same row.how i can change this to “duplicate” the rows and only show ona assosiation per line ?
asked
1 answers
1

Hey there,

in general it is not possible, because the datagrid sees your parent entity as 1 entity with multiple associated objects, in other words: there is only 1 object in the database to show.

 

What you could do is one of the following:

OPTION 1

  1. Use a datasource microflow to retrieve the list of your parent entity
    1. Loop over the list of parent entity
    2. Retrieve the list of associated entity
    3. Loop over the associated entity
    4. create an non persistent object for every associated entity in combination with the parent
    5. The result would be a list of non persistent entities with an association to a parent and a child
      1. if you have 1 parent with 6 childs, you would get 6 non persistents with all a link to the parent and the specific child

OPTION 2

  1.  Use a list view instead of a datagrid and nest a listview within the listview
    1. Place a listview for the parent
      1. Place a layout grid within the listview with 1 column for the name of the parent and a column for the associated children
      2. Place a listview in the second column and retrieve the associated children
  2. This will give you a list instead of a row, which will make the overall UX better

PS: you could also perform the second option with the DATAGRID 2 by having a custom content column which would contain another datagrid 2 for the associated children

answered