Created
January 24, 2016 13:28
-
-
Save amahdy/f8383e8467dfc2e44425 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BeanItemContainer<P> container = new BeanItemContainer<P>(P.class, ps); | |
final GeneratedPropertyContainer gp = new GeneratedPropertyContainer( | |
container); | |
gp.addGeneratedProperty("Col1", new PropertyValueGenerator<String>() { | |
@Override | |
public SortOrder[] getSortProperties(SortOrder order) { | |
return new SortOrder[] { new SortOrder("Col1", order | |
.getDirection()) }; | |
} | |
@Override | |
public String getValue(Item item, Object itemId, Object propertyId) { | |
return apply(((P) itemId).getVal()); | |
} | |
@Override | |
public Class<String> getType() { | |
return String.class; | |
} | |
}); | |
container.setItemSorter(new DefaultItemSorter() { | |
@Override | |
public void setSortProperties(Sortable container, | |
Object[] propertyId, boolean[] ascending) { | |
super.setSortProperties(gp, propertyId, ascending); | |
} | |
}); | |
grid.setContainerDataSource(gp); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment