How to fetch the dynamic attributes of the property in CollectionDatasource

Hi…
I am having dynamic attributes for an entity attribute(the entity attribute itself an entity). I have created the dynamic attributes for the attribute entity. When i tried to show the dynamic attributes of the attribute entity in the CollectionDataSource. The dynamic attributes are not showing in the table… I have also added visibility to the target screen…

How to show the dynamic attributes of the entity attribute in the table?

Hi,

This scenario is not supported by the platform and is not recommended for use.
If you really need to display the dynamic attrubutes of related entities, you can use a workaround like the following.

For example, Order has the dynamic attribute priority. To display priority in Customer editor, add the generated column and load the attribute using LoadContext:

<table id="ordersTable"
       height="100px"
       width="200px">
    <columns>
        <column id="amount"/>
        <column id="priority"
                generator="generatePriorityCell"/>
    </columns>
    <rows datasource="ordersDs"/>
</table>
public class CustomerEdit extends AbstractEditor<Customer> {

    @Inject
    private DataManager dataManager;

    public Component generatePriorityCell(Order entity) {
        LoadContext loadContext  = new LoadContext(Order.class).setId(entity.getId());
        loadContext.setLoadDynamicAttributes(true);
        Entity orderEntity = dataManager.load(loadContext);
		return new Table.PlainTextCell(orderEntity.getValue("+priority"));
    }
}

But you should take into account that querying the database for each table row will affect badly the performance of your application.