Sorting by dynamic fields (PlainTextCell)

Hello,

I am trying to sort Table by column with PlainTextCell values created with the following:

@Install(to = "myTable.personName", subject = "columnGenerator")
private Component personNameColumnGenerator(final Person person) {
String personName = person.getName();
if (Objects.isNull(person.getName())) {
    personName = String.format("%s %s %s",
                                  person.getFirstName(),
                                  person.getMiddleName(),
                                  person.getLastName());
}
return new Table.PlainTextCell(personName);
}

Can you suggest me some options how this should be done and also how to set click action on the label.

Hello,

could you clarify the problem with sorting?

Click event you can handle with Table.Column.ClickEvent, for instance:

@Subscribe("ordersTable.number")
public void onOrdersTableNumberClick(Table.Column.ClickEvent<Order> event) {
    notifications.create()
            .withCaption(event.getItem().getNumber())
            .show();
}