Announcement

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

  • Calendar day view with lanes and week view js errror

    Hi,

    I would like to have a calendar with both day and week view:

    calendar.setShowDayView(true);
    calendar.setShowWeekView(true);
    calendar.setShowMonthView(false);


    This is working fine, but I would also like to have lanes in day view, so:

    calendar.setShowDayLanes(true);

    And got this js error:

    Code:
    15:22:34.226:WARN:Log:TypeError: Cannot read property 'getTime' of null
    Stack from error.stack:
        cons.getDateTopOffset(<no args: exited>) on [WeekSchedule ID:isc_Calendar_0_weekView] @ CalendarView.js:4155:33
        cons.getSnapData(<no args: exited>) on [WeekSchedule ID:isc_Calendar_0_weekView] @ CalendarView.js:2715:32
        cons.tagDataForOverlap(<no args: exited>) on [WeekSchedule ID:isc_Calendar_0_weekView] @ CalendarView.js:2820:46
        cons.refreshEvents(<no args: exited>) on [WeekSchedule ID:isc_Calendar_0_weekView] @ CalendarView.js:3652:14
        cons.draw(<no args: exited>) on [WeekSchedule ID:isc_Calendar_0_weekView] @ CalendarView.js:4280:18
        cons.layoutChildren(<no args: exited>) on [PaneContainer ID:isc_Calendar_0_mainView_paneContainer] @ Layout.js:2592:20
        cons.drawChildren(<no args: exited>) on [PaneContainer ID:isc_Calendar_0_mainView_paneContainer] @ Layout.js:1381:11
        cons.draw(<no args: exited>) on [PaneContainer ID:isc_Calendar_0_mainView_paneContainer] @ Canvas.js:5187:14
        cons.drawChildren(<no args: exited>) on [TabSet ID:isc_Calendar_0_mainView] @ Canvas.js:6165:37
        cons.draw(<no args: exited>) on [TabSet ID:isc_Calendar_0_mainView] @ Canvas.js:5187:14
        cons.invokeSuper(<no args: exited>) on [TabSet ID:isc_Calendar_0_mainView] @ Class.js:1622:40
        cons.draw(<no args: exited>) on [TabSet ID:isc_Calendar_0_mainView] @ TabSet.js:2033:10
        cons.layoutChildren(<no args: exited>) on [HLayout ID:isc_HLayout_0] @ Layout.js:2592:20
        cons.drawChildren(<no args: exited>) on [HLayout ID:isc_HLayout_0] @ Layout.js:1381:11
        cons.draw(<no args: exited>) on [HLayout ID:isc_HLayout_0] @ Canvas.js:5187:14
        cons.drawChildren(<no args: exited>) on [Calendar ID:isc_Calendar_0] @ Canvas.js:6165:37
        cons.draw(<no args: exited>) on [Calendar ID:isc_Calendar_0] @ Canvas.js:5187:14
        cons.invokeSuper(<no args: exited>) on [Calendar ID:isc_Calendar_0] @ Class.js:1622:40
        cons.draw(<no args: exited>) on [Calendar ID:isc_Calendar_0] @ Calendar.js:5960:10
        Ghh_g$.rye_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:35259:13
        wPm_g$.xPm_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:205864:17
        wPm_g$.yPm_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:205868:8
        Array.HFc_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:14311:27
        initializeModules_0_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:28:30
        qL_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:4414:28
        tL_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:4484:14
        <anonymous>(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:4450:14
        _Ec_g$(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:41:40
        <anonymous>(<no args: exited>) @ 8A4693DFB016126B1C2DFCE4AD45ED74.cache.js:205886:46
    Complete test case:

    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.calendar.Calendar;
    import com.smartgwt.client.widgets.calendar.Lane;
    import java.util.Date;
    
    public class MainEntryPoint implements EntryPoint {
    
        public void onModuleLoad() {
    
            layout();
            SC.showConsole();
        }
    
        private void layout() {
    
            Calendar calendar = new Calendar();
            calendar.setStartDateField("startTime");
            calendar.setEndDateField("endTime");
            calendar.setShowDayView(true);
            calendar.setShowDayLanes(true);
            calendar.setShowWeekView(true);
            calendar.setShowMonthView(false);
            calendar.setShowWorkday(true);
    
            Lane[] lanes = new Lane[1];
            lanes[0] = new Lane("lane1", "Lane 1");
    
            Record[] data = new Record[1];
            data[0] = new Record();
            data[0].setAttribute("name", "test");
            data[0].setAttribute("title", "Test");
            data[0].setAttribute("lane", "lane1");
            Date today = new Date();
            today.setMinutes(0);
            Date hourLater = new Date();
            hourLater.setHours(today.getHours() + 1);
            hourLater.setMinutes(0);
            data[0].setAttribute("startTime", today);
            data[0].setAttribute("endTime", hourLater);
    
            calendar.setLanes(lanes);
            calendar.setData(data);
    
            calendar.draw();
        }
    
    }
    MichalG

    SmartClient Version: SNAPSHOT_v12.1d_2019-05-13/LGPL Development Only (built 2019-05-13)

    ps. Hope to get some other hint than "not supported" :-)


  • #2
    We've made a couple of changes here and you shouldn't see any further crashes in this circumstance - you can test out the changes in builds dated May 17 and later.

    We also fixed a bug around multi-day events - it remains the case, however, that multi-day events are not supported, and may behave unpredictably, in vertical CalendarViews.

    You could consider using a Timeline if you need better support for multi-day events.

    Comment


    • #3
      OK, thanks - no crashes with build dated 17 May.
      There is a side effect though. Events do not overlap if current view is not for today. Please, run the following example and go back to 16 of May view. There are two events for that date and they should overlap but they don't.
      Code:
      package pl.com.tech4.client;
      
      import com.google.gwt.core.client.EntryPoint;
      import com.smartgwt.client.data.Record;
      import com.smartgwt.client.util.SC;
      import com.smartgwt.client.widgets.calendar.Calendar;
      import com.smartgwt.client.widgets.calendar.Lane;
      import java.util.Date;
      
      public class MainEntryPoint implements EntryPoint {
      
          public void onModuleLoad() {
      
              layout();
              SC.showConsole();
          }
      
          private void layout() {
      
              Calendar calendar = new Calendar();
              calendar.setStartDateField("startTime");
              calendar.setEndDateField("endTime");
              calendar.setShowDayView(true);
              calendar.setShowDayLanes(true);
              calendar.setShowWeekView(false);
              calendar.setShowMonthView(false);
              calendar.setShowWorkday(true);
      
              Lane[] lanes = new Lane[1];
              lanes[0] = new Lane("lane1", "Lane 1");
      
              Record[] data = new Record[2];
      
              data[0] = new Record();
              data[0].setAttribute("name", "test");
              data[0].setAttribute("title", "Test");
              data[0].setAttribute("lane", "lane1");
              Date day = new Date();
              day.setMinutes(0);
              day.setDate(16);
              Date hourLater = new Date();
              hourLater.setHours(day.getHours() + 2);
              hourLater.setMinutes(0);
              hourLater.setDate(16);
              data[0].setAttribute("startTime", day);
              data[0].setAttribute("endTime", hourLater);
      
              data[1] = new Record();
              data[1].setAttribute("name", "test2");
              data[1].setAttribute("title", "Test2");
              data[1].setAttribute("lane", "lane1");
              Date otherDay = new Date();
              otherDay.setMinutes(0);
              otherDay.setDate(16);
              otherDay.setHours(day.getHours() + 2);
              Date hour2Later = new Date();
              hour2Later.setHours(day.getHours() + 3);
              hour2Later.setMinutes(0);
              hour2Later.setDate(16);
              data[1].setAttribute("startTime", otherDay);
              data[1].setAttribute("endTime", hour2Later);
      
              calendar.setLanes(lanes);
              calendar.setData(data);
      
              calendar.draw();
          }
      
      }
      Click image for larger version

Name:	donotoverlap.png
Views:	1
Size:	30.6 KB
ID:	257827

      Comment

      Working...
      X