full data grid with attributes from two entities

1
Hi everyone,  I am new at Mendix and I am struggling since two days with this issue and I will be really thankful for any help. I have a domain model with tree entities: Questions, Answers and Projects and I want to have a list view with a data grid on another page. The data grid have to be fulled with the attributes of two entities  (Questions and Answers).  How can I manage that?                Below the domain model and the data grid.  Thanks and Regards,
asked
1 answers
1

Hi Abbey,

With your current domain model structure. You can accomplish this with a datagrid for projects, a dataview set to listen to the projects datagrid, and then another datagrid for answers with an xpath constraint. 

 

This is the domain model I used.

 

This is the page I created.

 

The left side is a datagrid of all the projects. The right side is a datagrid inside a dataview. The datasource of the dataview is set to "list to widget" and I selected the datagrid of projects. The datagrid of answers is showing a column of an attribute from the answer table and then another column of an attribute from the questions table. 

The xpath constraint for the answers datagrid is 

[Module.Answer_Project/Module.Project = '[%CurrentObject%]']

 

This constraint ensures when a project record is selected, the grid of answers/questions only shows that specific projects Questions/answers.

 

Here is some helpful documentation:

listen to widget datasource for dataviews

https://docs.mendix.com/refguide/listen-to-grid-source

Xpath:

https://docs.mendix.com/refguide/xpath

Datagrid:

https://docs.mendix.com/refguide/data-grid

Hope this helps!

answered