Announcement

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

    Calendar getTime of null js error when event spans day in dayView

    Hi,

    When calendar event span more than one day and calendar view is set to 'day' then we get this error:

    Code:
    *12:04:06.434:WARN:Log:TypeError: Cannot read property 'getTime' of null
    Stack from error.stack:
        cons.getDateTopOffset(<no args: exited>) on [DaySchedule ID:isc_Calendar_0_dayView] @ CalendarView.js:4155:33
        cons.getSnapData(<no args: exited>) on [DaySchedule ID:isc_Calendar_0_dayView] @ CalendarView.js:2715:32
        cons.tagDataForOverlap(<no args: exited>) on [DaySchedule ID:isc_Calendar_0_dayView] @ CalendarView.js:2788:42
        cons.refreshEvents(<no args: exited>) on [DaySchedule ID:isc_Calendar_0_dayView] @ CalendarView.js:3652:14
        cons.draw(<no args: exited>) on [DaySchedule ID:isc_Calendar_0_dayView] @ CalendarView.js:4280:18
        cons.layoutChildren(<no args: exited>) on [VLayout ID:isc_Calendar_0_mainLayout] @ Layout.js:2592:20
        cons.drawChildren(<no args: exited>) on [VLayout ID:isc_Calendar_0_mainLayout] @ Layout.js:1381:11
        cons.draw(<no args: exited>) on [VLayout ID:isc_Calendar_0_mainLayout] @ Canvas.js:5187:14
        cons.layoutChildren(<no args: exited>) on [HLayout ID:isc_HLayout_0] @ Layout.js:2566: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
        com_smartgwt_client_widgets_BaseWidget_$draw__Lcom_smartgwt_client_widgets_BaseWidget_2V(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:7749:10
        Array.com_google_gwt_lang_pl_100046com_100046tech4_100046index_1_1EntryMethodHolder_init__V(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:2895:3
        initializeModules(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:39:20
        com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:620:21
        com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:669:14
        <anonymous>(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:643:12
        com_google_gwt_lang_ModuleUtils_gwtOnLoad__Lcom_google_gwt_core_client_JavaScriptObject_2Lcom_google_gwt_core_client_JavaScriptObject_2Lcom_google_gwt_core_client_JavaScriptObject_2Lcom_google_gwt_core_client_JavaScriptObject_2V(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:52:30
        <anonymous>(<no args: exited>) @ E7A9DB51EA6142D2BB2AEA8566636E0D.cache.js:21936:1
    Test case is as follows:

    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.datepicker.client.CalendarUtil;
    import com.smartgwt.client.data.Record;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.calendar.Calendar;
    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.setShowWeekView(false);
            calendar.setShowMonthView(false);
            calendar.setShowWorkday(true);
    
            Record[] data = new Record[1];
            data[0] = new Record();
            data[0].setAttribute("name", "test");
            data[0].setAttribute("title", "Test");
            Date yesterday = new Date();
            CalendarUtil.addDaysToDate(yesterday, -1);
            data[0].setAttribute("startTime", yesterday);
            Date tomorrow = new Date();
            CalendarUtil.addDaysToDate(tomorrow, 1);
            data[0].setAttribute("endTime", tomorrow);
    
            calendar.setData(data);
    
            calendar.draw();
        }
    
    }
    Thanks,

    MichalG

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

    #2
    Multi-day events are not currently supported (regardless of which view). If you're interested in such support, consider Feature Sponsorship.

    Comment

    Working...
    X