I've made a Vaadin table which contains (apart from Strings) a button (with a link style and description) and it works great.
Only 1 problem: I can't sort the column! I've been trying to find a way to override the normal sorting of the column so it will take my Button's value and then sort it from A-Z or Z-A. I guess the default is just a toString of the field but I don't know for sure.
Example:
The table column (as where it's generated):
table.addContainerProperty(Translator.translate("column.message"), Button.class, null);
...
Button messageButton = prepareButton(result); resultComponent.getTable()开发者_如何学Go.addItem(new Object[] { messageButton, result.getPortlet(), result.getSsn(), result.getSam(), result.getDate() }, itemId++);
Any way I can override the sorting? Or write my own sorting class or something along those lines.
Take a look at this. To sum it up, you can either extend the component (in this case the Vaadin button) and have the subclass implement Comparable or you can use an ItemSorter.
精彩评论