Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Creating a custom bean id
I have the following container :
BeanContainer<Integer, Person> container = new BeanContainer<Integer, Person>(Person.class); container.setBeanIdProperty("lastName");
Where person has a "lastName", "firstName" and "town" attributes.
I'm passing this container to my table :
The problem is that I want to have a bean id property value (called "fullname") that is the result of the lastname and firstname concatenation.
How can I do this wit the setTableFieldFactory and createField methods ?
The quick solution I guess would be to define a method getFullName() in your bean and use "fullName" as a bean ID.
I know ... but i'm experimenting the setTableFieldFactory :)
A field factory (as well as an overridden formatPropertyValue()) work on single properties. Furthermore, a TableFieldFactory just creates the field but its value is set separately later.
If you want to combine multiple properties, you can use a generated column (Table.addGeneratedColumn()).