Dynamic UI column name

Hi all guys.

Is there a way to give the user the possibility to name a Table column has he need?

For example Order entity has id, date, customer, field1, field2.
Fields 1 and 2 are generic String fields where user can store everything he needs. And it would be easier for him to customize the name of the column table “fields1” to “foo”.

Thanks for your support.

Hello!

You can change the caption of column in the controller:

@Inject
private GroupTable<SomeEntity> myTable;

myTable.getColumn("field1").setCaption("User's caption");

And save and restore it by using settings mechanism:

@Override
protected void applySettings(Settings settings) {
    super.applySettings(settings);

    Element tableElement = getSettings().get("myTable");

    // restore caption
}

@Override
protected void saveSettings() {
    Element tableElement = getSettings().get("myTable");

    // save caption

    super.saveSettings();
}

Your table should use settingsEnabled="true" (it’s true by default).