Yes,
once you have an Calendar object instance, you use it as a 2nd argument of newRow.columnDataSet().
Also note as 1st argument, you can use also the column name (String). e.g. newRow.columnDataSet("myDateTimeCol", myCalendarInstance);
an example I used once, uses different method of new Datagrid row creation, however shows how to parse ResultSet into Datagrid for String, Long (RTDM Integer), Double and Calendar (RTDM Datetime). You can create new empty row and use columnDataSet as well.
if (rs != null) { List<Object> list = new ArrayList<Object>(); while (rs.next()) { //read values from ResultSet and add them into offerRepDatagrid list.add(getLong(rs, "Col1")); list.add(rs.getString("Col2")); list.add(getDouble(rs, "Col3")); list.add(getCalendar(rs, "Col4")); offerRepDatagrid.rowAdd(list); list.clear(); rsCount++; } } if (rs != null) rs.close();
private Long getLong(ResultSet rs, String colName) throws SQLException { long l = rs.getLong(colName); return rs.wasNull() ? null : l; } private Double getDouble(ResultSet rs, String colName) throws SQLException { Double d = rs.getDouble(colName); return rs.wasNull() ? null : d; }
private Calendar getCalendar(ResultSet rs, String colName) throws SQLException { Calendar c = Calendar.getInstance(timeZone); Date d = rs.getDate(colName); if (rs.wasNull()) return null; else { c.setTime(d); return c; } }
... View more