Hi,
I’m using Vaadin 6.7.4 in my project. So I have a dataset that is retrieved from database and I need populate Table component in the form.
I’m using
formatPropertyvalue
method to format my date column, see below:
add column to the table
mainComponent.addContainerProperty(transactionDt, TDate.class, null);
@Override
protected Table createMainComponentInstance() {
return new Table()
{
/**
*
*/
private static final long serialVersionUID = -8188804282068331981L;
@Override
protected String formatPropertyValue(Object rowId, Object colId, Property property) {
// TDate field
if (property.getType() == TDate.class) {
SimpleDateFormat df = new SimpleDateFormat("dd.MM.yyyy");
try {
TDate dt = (TDate) property.getValue();
return df.format(dt.getUtilDate());
}
catch(Exception ex) {
}
}
return super.formatPropertyValue(rowId, colId, property);
}
};
}
after this format the Header Sort on this column does now work. I’m not able sort at all on this field. So where I’m wrong how to fix?