Harry3
(Harry Leps)
January 13, 2012, 1:48pm
1
Hi everyone,
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 :
table.setContainerDataSource(container);
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 ?
Thank you.
Alexander6
(Alexander Pchelintsev)
January 13, 2012, 2:14pm
2
Hi,
The quick solution I guess would be to define a method getFullName() in your bean and use “fullName” as a bean ID.
cheers,
aleksandr
Harry3
(Harry Leps)
January 13, 2012, 2:23pm
3
I know … but i’m experimenting the setTableFieldFactory
Henri2
(Henri Sara)
January 14, 2012, 12:20pm
4
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()).