diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java index d9b2d70..3152853 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java @@ -268,9 +268,16 @@ public class TabularDataXGridPanel extends ContentPanel { .getCell()); DataRowColumnConfig cSelected = (DataRowColumnConfig) colSelected; ColumnDefinition cdSelected = cSelected.getDefinition(); - String cellValue = row.getFieldAsText(cdSelected + + String cellValue; + if(cdSelected.getColumnDataType().compareTo("Date")==0){ + cellValue = row.getFieldAsDate(cdSelected + .getColumnLocalId()); + } else { + cellValue = row.getFieldAsText(cdSelected .getColumnLocalId()); - + } + String columnIdValue = row.getFieldAsText(columnIdSelected .getColumnLocalId()); diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/config/Row.java b/src/main/java/org/gcube/portlets/user/tdwx/client/config/Row.java index 8d8b5a5..fd470a6 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/config/Row.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/config/Row.java @@ -3,12 +3,15 @@ */ package org.gcube.portlets.user.tdwx.client.config; +import java.util.Date; import java.util.Map; import org.gcube.portlets.user.tdwx.shared.model.ColumnKey; import org.gcube.portlets.user.tdwx.shared.model.DataRow; +import com.google.gwt.i18n.client.DateTimeFormat; + /** * * @author "Giancarlo Panichi" @@ -54,6 +57,19 @@ public class Row { return String.valueOf(value); } + /** + * Returns the specified field as text value. + * @param fieldId the field id. + * @return the text value. + */ + public String getFieldAsDate(String fieldId) + { + Date value = (Date)getField(fieldId); + DateTimeFormat sdf= DateTimeFormat.getFormat("yyyy-MM-dd"); + return sdf.format(value); + } + + /** * Returns the specified field as request value type T. * If a wrong type is specified a {@link ClassCastException} will be throw.