Displaying table column value as a combination of two or more entity attributes

I am looking for some help on displaying a column value as a combination of two or more Entity attributes.

For example: I have an entity named “Contact” with attributes “firstName”, “middleName” & “lastName”. How can I display the concatenation of values of these attributes under a column named “Name” in a simple table using CUBA framework?

Note: I am using CUBA Platform: 6.7.9

1 Like

hi Jasvir,

generally your question is answered here:

In case you want to do filtering through the generic filter mechanism, you have to persist the column. That can be easily achieved via entity listeners.


Hi Jasvir,

The easiest way would be to add a generated column:

  1. DataGrid: https://doc.cuba-platform.com/manual-latest/gui_DataGrid.html#gui_DataGrid_addGeneratedColumn
  2. Table: https://doc.cuba-platform.com/manual-latest/gui_Table.html#gui_Table_addGeneratedColumn

For example:

    contactsTable.addGeneratedColumn("combo", entity -> {
        TextField field = componentsFactory.createComponent(TextField.class);
        Contact contact = (Contact) contactsTable.getItemDatasource(entity).getItem();
        field.setValue(contact.getFirstName() + " " + contact.getMiddleName() + " " + contact.getLastName());
        return field;
1 Like

Thanks Olga.

I could achieve this using @MetaProperty in my entity class.

1 Like