Multiple Entities in one Data Grid

0
Hey all,   is there a way to source multiple entities in one Data Grid?   So, I have multiple types of learning materials – Book, Printable and Digital. I’ve decided to setup my Domain Model with 4 entities so I can use inheritance:     How would I go about combining these 4 into one Data Grid so I can search for the materials regardless of their type?   Thanks, Matija
asked
2 answers
4

Hi Matija,

 

You decided on generalizations and that is one way to model it. In that case, you should create an overarching (non-persistent) object that you can use for all 3 generalized materials, and you populate using a Data Source Microflow and expose the non-persistent entity to the grid2 widget. 

 

You can also remodel the Domain Model to have 1 Entity Material with an Enumeration for the type (Digital, Printable, Book). The Entity is the superset of all the attributes of the current Objects. 

 

While filling the data, you can use the Enumeration for Visibility conditions of the Text boxes so that you only have input files based on the type Enumeration. In that case, it is easier to handle them together, but it is still possible to treat them based on the Enumeration type. Also, the selection using XPath can use the Enumeration type.

 

So, two options.

 

Go Make It

 

answered
2

I would opt for using the listview with Material as datasource entity. And create templates in the listview per specialization.

See documentation on templates: https://docs.mendix.com/refguide/list-view/#templates

I know a data grid is different to a data grid, though it can be modeled representing a grid.

 

Add a specialization template

 

Switch to Specialization template

answered