How can I save Date fields in MySql ?
SmartGwt is saving logical data in a very very very long format
I can manage the nice display fomat (yyyy-mm-dd) and the nice UI interface with masks and drop down calendar but I can not let SmartGwt save in MySql Date fields
(I receive an error "illegal Date") and I have to make varchar(40) fields because on the server the date arrives like this
Mon May 05 00:00:00 EEST 2014
Wed Jan 01 00:00:00 EET 2014
Sat Aug 30 00:00:00 EEST 2014
Sun Feb 02 00:00:00 EET 2014
(and for MySql this is illegal Date but perfect Varchar(40))
I tried this code
Data source
DataSourceField fld = new DataSourceField( field_name,
FieldType.DATE, field_label, 30, required);
....
countryDS.setFields( fields_list);
and Java
started from
ListGridField fld_edit = new ListGridField( field_name, field_label);
which works for Varchar(40) but with a better UI I changed it to
ListGridField fld_edit = new ListGridField( field_name, field_label);
fld_date = new DateItem( field_name, field_label);
fld_date.setInputFormat( "YMD");
fld_date.setUseTextField( true);//one field - ot 3 boxes
fld_date.setMaskDateSeparator( "-");
fld_date.setUseMask( true);
fld_date.setType( "date");//setType( "text");
fld_edit.setType( ListGridFieldType.DATE);
fld_edit.setAttribute( "useTextField", true); //one field not 3 boxes
fld_edit.setAttribute( "inputFormat", "YMD");//yyyy-mm-dd
fld_edit.setEditorProperties( fld_date);
fld_edit.setAlign( Alignment.LEFT);
and a lot of parsers and formaters who just give you some hope on the screen but have no effect on the data send to the server (as is described in the documentation)
Thank you
Dorin
SmartGwt is saving logical data in a very very very long format
I can manage the nice display fomat (yyyy-mm-dd) and the nice UI interface with masks and drop down calendar but I can not let SmartGwt save in MySql Date fields
(I receive an error "illegal Date") and I have to make varchar(40) fields because on the server the date arrives like this
Mon May 05 00:00:00 EEST 2014
Wed Jan 01 00:00:00 EET 2014
Sat Aug 30 00:00:00 EEST 2014
Sun Feb 02 00:00:00 EET 2014
(and for MySql this is illegal Date but perfect Varchar(40))
I tried this code
Data source
DataSourceField fld = new DataSourceField( field_name,
FieldType.DATE, field_label, 30, required);
....
countryDS.setFields( fields_list);
and Java
started from
ListGridField fld_edit = new ListGridField( field_name, field_label);
which works for Varchar(40) but with a better UI I changed it to
ListGridField fld_edit = new ListGridField( field_name, field_label);
fld_date = new DateItem( field_name, field_label);
fld_date.setInputFormat( "YMD");
fld_date.setUseTextField( true);//one field - ot 3 boxes
fld_date.setMaskDateSeparator( "-");
fld_date.setUseMask( true);
fld_date.setType( "date");//setType( "text");
fld_edit.setType( ListGridFieldType.DATE);
fld_edit.setAttribute( "useTextField", true); //one field not 3 boxes
fld_edit.setAttribute( "inputFormat", "YMD");//yyyy-mm-dd
fld_edit.setEditorProperties( fld_date);
fld_edit.setAlign( Alignment.LEFT);
and a lot of parsers and formaters who just give you some hope on the screen but have no effect on the data send to the server (as is described in the documentation)
Thank you
Dorin