Datagrid with variable content.

0
Hi everybody,   let's assume I have the following entities:   In the entity I18nPart, there are some arbitrary parts, identified by their part number (there are more columns, but we don't need them here). In the entity "I18nPartDescription", there is the description for a part in various languages (so one entry for each language of a part).   In a Datagrid 2, I want to show the columns "Partnumber" and "Description", depending on the selected language of the user. As I understand, I have to use a Database entity as data source, if I don't want to lose the built in paging / sorting functions. So I would like to avoid using a microflow, where I would have to implement it on my own (as far as I understood).   What do you think is the best approach to view those data in a data grid 2?   Thanks, Holger  
asked
3 answers
1

Hello Holger,

 

What I think you need is an entity that contains the different languages your description is available in as object, and an association to your part description and an association to your user entity.

 

part description * - 1 languagesetting

 

user * - 1 language setting

 

After this the enumeration is superfluous so you can delete it if you want.

 

After you need to make sure that you give the page where you want to show your datagrid 2 can reach the language setting of the user at least, so maybe the user as well, as a parameter, then you can use this parameter in your datagrid2 and you can apply a xpath filter on your datagrid. Where the language of the partdescription is equal to the selected language of the user.

 

You could even do this on database level if you would like.

 

Hope this helps,

 

Good luck!

answered
1

Hi Jelle,

 

thank you for your answer, wich lead me the right way.

 

I kept the two entities I already had designed. The crux of the matter was to not selecting the I18nPart entity as data source for the data grid 2, but the entity I18nPartDescription with the xpath constraint on the selected language. I always thought that I have to use the I18nPart entity as data source and then had no possibility to get the linked entries of I18nPartDescription.

 

So for all who want to do something similar, here is the solution.

 

Here is the domain model:

domain.jpg

 

And here the data source of the data grid 2:

datasource.jpg

 

Best,

Holger

answered
0

Silly me, I must revert my statement from above.

In the data grid, I didn't use the partnumber from the I18nPart entity, but from the I18nPartDescription. Although I could select the partnumber from I18nPart, it is always empty...

 

So, unfortunately no solution so far.

 

Does anybody know why the entries are empty when I use a field of an associated entity in data grid 2?

answered