SmartClient Version: v10.0p_2015-02-09/Pro Deployment (built 2015-02-09)
I have some problems with a Timeline that uses DataSourceDateField for startDate and endDate instead of DataSourceDateTimeField
When using only Date and not DateTime, an event that starts today and end today will take up the entire day in the Timeline (Which is exactly what I want), but this logic does not persist to drag resizing. If I resize an event to fill the entire day of today, it will have end date tomorrow instead. (See attached picture)
Another problem is that some events overlap if one event has the same start date as the other event's end date (See attached picture)
Testcase based on the DataBound Timeline example in the showcase.
I have some problems with a Timeline that uses DataSourceDateField for startDate and endDate instead of DataSourceDateTimeField
When using only Date and not DateTime, an event that starts today and end today will take up the entire day in the Timeline (Which is exactly what I want), but this logic does not persist to drag resizing. If I resize an event to fill the entire day of today, it will have end date tomorrow instead. (See attached picture)
Another problem is that some events overlap if one event has the same start date as the other event's end date (See attached picture)
Testcase based on the DataBound Timeline example in the showcase.
Code:
public Timeline getTimeline() { DataSource eventDS = new DataSource(); DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId"); eventIdField.setPrimaryKey(true); DataSourceTextField nameField = new DataSourceTextField("name"); DataSourceTextField descField = new DataSourceTextField("description"); DataSourceDateField startDateField = new DataSourceDateField("startDate"); DataSourceDateField endDateField = new DataSourceDateField("endDate"); DataSourceTextField laneField = new DataSourceTextField("lane"); eventDS.setFields(eventIdField, nameField, descField, startDateField, endDateField); eventDS.setClientOnly(true); eventDS.setTestData(TimelineData.getRecords()); Timeline calendar = new Timeline(); calendar.setHeight(451); calendar.setEventSnapGap(60 * 24); calendar.setLaneEventPadding(3); calendar.setStartDate(new Date()); calendar.setData(TimelineData.getRecords()); calendar.setLanes(TimelineLaneData.getRecords()); calendar.setCanEditLane(true); calendar.setShowEventDescriptions(false); calendar.setDisableWeekends(false); calendar.setLaneFields(new ListGridField[]{ new ListGridField("title", "Developer", 120)}); calendar.setDataSource(eventDS); calendar.setAutoFetchData(true); HeaderLevel headerLevel = new HeaderLevel(TimeUnit.DAY); headerLevel.setTitleFormatter(new HeaderLevelTitleCustomizer() { @Override public String getTitle(HeaderLevel headerLevel, Date startDate, Date endDate, String defaultValue, Calendar calendar) { DateTimeFormat fmt = DateTimeFormat.getFormat("d/M"); return fmt.format(startDate); } }); calendar.setResolution(new HeaderLevel[] {new HeaderLevel(TimeUnit.WEEK), headerLevel}, TimeUnit.DAY, 21, null); return calendar; } public static class TimelineData { private static CalendarEvent[] records; private static Date today = new Date(); private static int year = today.getYear(); private static int month = today.getMonth(); private static int start = today.getDate(); public TimelineData() { } public static CalendarEvent[] getRecords() { if (records == null) { records = getNewRecords(); } return records; } public static CalendarEvent[] getNewRecords() { return new CalendarEvent[]{ new CalendarEvent(1, "One Day", "", DateUtil.getLogicalDateOnly(new Date(year, month, start)), DateUtil.getLogicalDateOnly(new Date(year, month, start )), "charlesMadigen"), new CalendarEvent(2, "Two Days", "", DateUtil.getLogicalDateOnly(new Date(year, month, start)), DateUtil.getLogicalDateOnly(new Date(year, month, start + 1)), "tamaraKane"), new CalendarEvent(3, "Three Days", "", DateUtil.getLogicalDateOnly(new Date(year, month, start)), DateUtil.getLogicalDateOnly(new Date(year, month, start + 2)), "darcyFeeney"), new CalendarEvent(4, "Test", "", DateUtil.getLogicalDateOnly(new Date(year, month, start+ 2)), DateUtil.getLogicalDateOnly(new Date(year, month, start + 6)), "darcyFeeney") }; } } public static class TimelineLaneData { private static Lane[] records; public static Lane[] getRecords() { if (records == null) { records = getNewRecords(); } return records; } public TimelineLaneData() { } public static Lane[] getNewRecords() { Lane[] lanes = new Lane[]{ getLane("charlesMadigen", "Charles Madigen", "Managers"), getLane("tamaraKane", "Tamara Kane", "Developers"), getLane("darcyFeeney", "Darcy Feeney", "Managers") }; return lanes; } private static Lane getLane(String name, String title, String devGroup) { Lane lane = new Lane(name, title); lane.setAttribute("devGroup", devGroup); return lane; } }
Comment