Select an object and show its properties on another page.

0
Hi everyone. I have a doubt because I have 2 pages, the subjects one and the teachers one. On the teachers one I have a data grid that contents all their names and all I want to do is select one teacher, save it and show its name in a text on the subjects page. Anyone know how to do it? Thanks for your attention.
asked
2 answers
0

You must associate the Teacher and Subject entities in your domain model.

When you edit Teacher select the subjects they teach or when you edit the Subject, select the Teacher who teaches it.

Then based on the association, you could show the teacher name in the next page.

If for some reason, you dont want to associate, but still show the teacher name, then you must go with non-Persistable entity and store the teacher name in an attribute. 

Use the NPE as page entity and design the page with other entities you may need.

answered
0

A fast way, most of the time, is to go to your domain model, set the association, then right-click and ‘Generate overview pages’.

In your domain model, what association do you have between Subject and Teacher.

If each subject has only one teacher, it is easy:

- add a reference selector on the Subject-page in the dataview

- assign attribute Subject_Teacher/Teacher/Name to it

If they are related *-*: each subjects gets tought by several teachers and each teacher teaches several subjects, then instead of a reference-selector, use a reference set-selector.

 

answered