I'm taking a record fron a grid to populate some item in a dynamicform. The
problem is i cannot display dates in the right format for the form, it
keeps displaying then as they are in the grid and whatever i do to format
the date is just ignored by SmartGWT. I'm a bit confused. Below you'll find
my code. Can anyone help me out?
dataTrade = new DateItem();
dataTrade.setTitle(Nove.getInstance().getConstants().dataTrade());
dataTrade.setName(RecordEditMovTitUploadDS.DATA_TRADE);
dataTrade.setWidth(100);
dataTrade.setAlign(Alignment.LEFT);
dataTrade.setUseTextField(true);
String dataT =
movTitRecord.getAttribute(ListMovTitByValCodTitDetailDS.DATA_TRADE);
DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-MM-dd
HH:mm:ss.SSS");
Date dateTr = null;
try{
dateTr = dateTimeFormat.parse(dataT);
} catch(IllegalArgumentException e){
SC.say("Couldn't parse date");
}
DateTimeFormat dateTimeFormat2 = DateTimeFormat.getFormat("dd/MM/yyyy");
String dateTra= dateTimeFormat2.format(dateTr);
//dataTrade.setDisplayFormat(DateDisplayFormat.TOEUROPEANSHORTDATE);
//dataTrade.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
dataTrade.setInputFormat("dd/MM/yyyy");
dataTrade.setDefaultValue(dateTra);
To be more specific in debug the date is correctly formatted, when i pass
the value to setDefaultValue it is dd/MM/yyyy as it should but when i load
the page the format is still yyyy-MM-dd HH:mm:ss.SSS and i cannot
understand why...
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.