There seems to be an issue with the JSON encode and decode functions, prohibiting them to be used in tandem for a date item.
The following code showcases the issue:
The last line never assigns the date value.
Tested with SmartClient Version: v8.1p_2012-11-28/LGPL Development Only (built 2012-11-28).
I have tested this under Chrome and Firefox (latest releases for both browsers) on both Windows (7 64bit) and Linux (Ubuntu 12.10 64bit).
Though I doubt it is platform specific.
The only related log I could get was under dev mode:
which is of course strange as the format of the encoding output is controlled by SmartGWT and it should be accepted by the decode, on the opposite direction.
The following code showcases the issue:
Code:
ListGridRecord record = new ListGridRecord(); Date date = new Date(); record.setAttribute("myDateField", date); ListGridRecord rec = new ListGridRecord(JSON.decode(JSON.encode(record.getJsObj()))); Date dt = rec.getAttributeAsDate("myDateField"));
Tested with SmartClient Version: v8.1p_2012-11-28/LGPL Development Only (built 2012-11-28).
I have tested this under Chrome and Firefox (latest releases for both browsers) on both Windows (7 64bit) and Linux (Ubuntu 12.10 64bit).
Though I doubt it is platform specific.
The only related log I could get was under dev mode:
Code:
JavaScriptException: (TypeError) @com.smartgwt.client.util.JSOHelper::getAttributeAsDate(Lcom/google/gwt/core/client/JavaScriptObject;Ljava/lang/String;) ([JavaScript object(8), string: 'myDateField']): Object 2013-03-11T14:15:29 has no method 'getTime'
Comment