Updating table with value from another entity

My sales order Entity has Product and when I select a Product in Order entry UI, i want to show the product specification description from Product Entity.

I guess I have to use a listener but not sure how it update the respective column of the table:

  //update Style
        linesDs.addItemPropertyChangeListener(e -> {
            if ("product".equals(e.getProperty())) {
1 Like

Probably something like this:

linesDs.addItemPropertyChangeListener(e -> {
            if ("product".equals(e.getProperty())) {

Hi Thanks. But I guess I was not very clear with required info.

The ProductDescription is not part of LinesDs as it is not included in the entity. I have manually added the column in the table from product.productDescription. As a result, I do not fine this “…setProductDescription…”. When I load an existing sales order, this description is updated but not when I update the Product.

Thanks for your further help.

How did you add your product.productDescription column, through XML or using addGeneratedColumn?

I just defined as column in the Studio. It works when I load it next time.

By default Table watches only for changes in collection datasource, but not changes in related objects. So, you have to call repaint() method of your table manually after changing your related attributes programmatically:

Example XML:

<table id="usersTable" width="100%">
        <column id="login"/>
        <column id="group.name"/>
    <rows datasource="usersDs"/>

Change group.name programmatically and repaint table:

usersDs.getItem().getGroup().setName("Change group name!");
1 Like