Table (Assigned Authors). GenerateColumn to Display list of all ScientificPapers using Data Manager

With reference to old topic :

Two Tables : Assigned Authors (authorsbyPapersDs) and Unassigned Authors (authorsDs). Authors can be assigned to ScientificPaper (ScientificPaperDs) and can also be unassigned.

My Question is :

On Table (Assigned Authors). I would like to display list of ScientificPapers (other ScientificPapers) that belong to that Assigned Author in a row using generatecolumn.

I can use Popup Button to display the list of Paper belonging to Author (Example Assigned Author) and use addaction to perform action (like opening that paper by id).

The issue is : Table 1 needs 3 collection Datasource. authorsByPaperDs, authorsDs and scientificPapersDs.

All 3 datasources are linked by One to Many Relationship. Author can have multiple Papers. Assigned Author can have multiple papers. ScientificPapers can have multiple Assigned Authors.

I believe this can be achieved using DataManager.

Some sample implementation or idea for adding a generatedcolumn to AssignedAuthor Table which shows list of all Scientific Papers belonging to each Assigned Author in a row using DataManager will be helpful.

I am aware of the method for generating a column and adding an action.

I am not aware on how to add the list (Assigned Author with list of ScientificPapers) using DataManager to the new column of Assigned Author Table.

Thanks for your guidance.


The idea is very simple. First of all, you should prepare a container for components that will represent single ScientificPaper.
Then you should create LoadContext and set a query that returns a list of papers that are related to Author.
And the final step is iterating over the list with papers and creating components that will represent the single paper.
And the code to do it is something like this:

DataManager dataManager = AppBeans.get(DataManager.class);

ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.class);

table.addGeneratedColumn("papersColumn", entity -> {
    HBoxLayout container = componentsFactory.createComponent(HBoxLayout.class);

    LoadContext<ScientficPaper> ctx = new LoadContext(ScientificPaper.class);

    // you should use 'entity' in the query
    List<ScientificPaper> papers = dataManager.loadList(ctx);

    for (ScientificPaper paper : papers) {
        Label label = componentsFactory.createComponent(Label.class);

    return container;

Best regards,