Setting custom input format for date editor causes parse error.
Version: 6.0p/LGPL/2016-10-23
Version: 6.0p/LGPL/2016-10-23
Code:
public static final int RECORD_COUNT = 5; String customFormat = "yyyy.MM.dd"; public void onModuleLoad() { ListGrid grid = new ListGrid(); grid.setDataSource(new TestDS()); grid.setAutoFetchData(true); grid.setWidth(600); grid.setHeight(400); grid.setEditByCell(true); grid.setCanEdit(true); RootPanel.get("listGridContainer").add(grid); } private class TestDS extends DataSource { public TestDS() { setID("localTestDS"); DataSourceIntegerField dsField1 = new DataSourceIntegerField("F1", "Id"); dsField1.setPrimaryKey(true); DataSourceDateField dsField2 = new DataSourceDateField("F2", "Field 2"); dsField2.setFormat(customFormat); DateItem editorProperties = new DateItem(); editorProperties.setFormat(customFormat); editorProperties.setInputFormat(customFormat); dsField2.setEditorProperties(editorProperties); setFields(dsField1, dsField2); setTestData(getData()); setClientOnly(true); } private ListGridRecord[] getData() { ListGridRecord[] listGridRecords = new ListGridRecord[RECORD_COUNT]; for (int i = 0; i < RECORD_COUNT; i++) { listGridRecords[i] = createRecord(i); } return listGridRecords; } private ListGridRecord createRecord(int i) { ListGridRecord listGridRecord = new ListGridRecord(); listGridRecord.setAttribute("F1", i); listGridRecord.setAttribute("F2", new Date()); return listGridRecord; } }
Comment