Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Calendar and Timeline - 3.1d

    Trying to play around with this much-needed feature for our release later this year and running into some issues.

    The build I have is the latest one as of this post timestamp.

    I have a ds descriptor as follows:
    Code:
    <fields>
    		<field name="JIT_SCHD_CONST_PK" type="sequence" sequenceName="JIT_SCHEDULE_CONST_SEQ" title="JIT_SCHD_CONST_PK" primaryKey="true" hidden="true"></field>
    		<field name="PROGCOMP_FK" type="int" title="PROGCOMP_FK" hidden="true"></field>
    		
    		<field name="START_DATE" type="datetime" title="Exclusion Date">
    			<!-- <validators>
    				<validator type="dateRange" min="$currentDate"/>
    			</validators> -->
    		</field>
    		<field name="END_DATE" type="datetime" title="End Date"></field>
    		
     		<field name="NAME" type="text" title="Name" required="true"></field>
    		<field name="DESCRIPTION" type="text" title="Description"></field>
     				
    		<field name="USER_ID" type="string" title="USER_ID" hidden="true"></field>
    		<field name="ROW_TIMESTAMP" type="datetime" title="ROW_TIMESTAMP" hidden="true"></field>
    	</fields>
    	
     	 <operationBindings>
    		<operationBinding operationType="fetch">
    			<orderClause>START_DATE, END_DATE, NAME</orderClause>
    		</operationBinding>
    		<operationBinding operationType="add">
    			<!-- <values fieldName="PROGCOMP_FK" value="-1"></values> -->
    			<!-- <values fieldName="END_DATE" value="$values.START_DATE"></values> -->
    		</operationBinding>
    		<operationBinding operationType="update"/>
    		<operationBinding operationType="remove"/>
    	</operationBindings>
    My code is as follows:
    Code:
    public class CalendarDetailsViewer extends VLayout {
    	private TabSet detailsTabSet;
    	private static DataSource calendarDS = DataSource.getDataSource("jitCalendar");
    	private Tab calendarTab = null;
    	private Tab timelineTab = null;
    	public static int MEMBER_MARGIN = 8;
    
    	public CalendarDetailsViewer(TabSet detailsTabSet){
    		this.detailsTabSet = detailsTabSet;
    		setupContents();
    	}
    	
    	private void setupContents() {
    		calendarTab = new Tab("Calendar");
    		
    		Calendar calendar = new Calendar();
    		calendar.setStartDateField("START_DATE");
    		calendar.setLeadingDateField("START_DATE");
    		calendar.setEndDateField("END_DATE");
    		calendar.setTrailingDateField("END_DATE");
    		calendar.setNameField("NAME");
    		calendar.setDescriptionField("DESCRIPTION");
    		
    		calendar.setDataSource(calendarDS);
    		calendar.setAutoFetchData(true);
    //		calendar.setShowDayView(false);
    //		calendar.setShowWeekView(false);
    //		calendar.setCanCreateEvents(false);
    //		calendar.setCanEditEvents(false);
    //		calendar.setShowTimelineView(true);
    		
    		calendarTab.setPane(calendar);
    		detailsTabSet.addTab(calendarTab);
    		
    //		timelineTab = new Tab("Timeline");
    //		Timeline timeline = new Timeline();
    //		timeline.setStartDateField("START_DATE");
    //		timeline.setEndDateField("END_DATE");
    //		timeline.setNameField("NAME");
    //		timeline.setDescriptionField("DESCRIPTION");
    //		timeline.setDataSource(calendarDS);
    //		
    //		timelineTab.setPane(timeline);
    //		detailsTabSet.addTab(timelineTab);
    	}
    }
    Whenever I set setShowTimeline(true) on a Calendar object, I get a stacktrace error and nothing happens. Whenever I try to create a Timeline object, I get the same error. There are no errors in the console or logs - just a popup error.

    That aside, what is the correct use of StartDateField, EndDateField, LeadingDateField, TrailingDateField, etc. We are trying to show events that span multiple days and are unable to do so. I've tried using the same fields as the start and end dates for the leading and trailing and that doesn't seem to work.

    Any thoughts on these issues?

    #2
    Take a look at the docs for eg trailingDateField - these are for showing additional lines outside of the event. The use case here is to show lead times before an event or effects after an event (such as a room still being unavailable because it needs to be cleaned up).

    It sounds as if you don't want to set these and setting them to the same field as start/end would be invalid anyway.

    Once you get rid of these settings, if you're still having an exception, please post details.

    Comment


      #3
      I was getting the exception before trying to do anything with trailing/leading dates.

      There aren't any details to post since nothing shows up in the log - I get a JS Error stack trace that pops up on the screen. I'll get a screenshot and a new code example.

      I've tried recompiling, clearing cache, etc since I go back and forth between 3.0 and 3.1d frequently for test purposes.

      Comment


        #4
        That stack trace would be useful. By the way you should not need a screenshot - the same trace is reported in the GWT Development mode console and the SmartGWT Developer Console.

        Comment

        Working...
        X