Reputation: 1316
I have several columns in a Vaadin Grid that only contain values of items that are in a sortable Container, but they're added as Generated Properties as well due to the fact that there needs to be custom HTML title-tag to go with the value. With Generated Property and HtmlRenderer it works and renders fine, but using them makes all the columns unsortable. With a Table this could be done with a CellStyleGenerator I think, but there are several advantages with the Grid. Is there any workaround to fix this and make the columns sortable again?
Using a HtmlRenderer together with a Converter should work otherwise, but I need the object reference itself and not just the field the Converter has, as the html title-tag needs to contain some meta-information.
Upvotes: 3
Views: 1954
Reputation: 4385
I recently stumbled upon the same problem if I understood your question correctly.
For me, to make the generated columns sortable, I needed to override the method getSortProperties()
when providing the ValuGenerator<T>
to the GeneratedPropertyContainer
:
GeneratedPropertyContainer container = new GeneratedPropertyContainer(originalContainer);
container.addGeneratedProperty("property-id", new PropertyValueGenerator<T>() {
[...]
@Override
public SortOrder[] getSortProperties(SortOrder order) {
return new SortOrder[] {order};
}
});
Upvotes: 2