SmartClient Version: v11.0p_2016-04-27/LGPL Development Only (built 2016-04-27)
FF 24.8.0, Chrominium 38.0.2125.101 (290379) (64-bit) on Gentoo linux
Hi,
The following exception is thrown when Timeline refreshes itself for various reasons, for example when event start date is changed via datasource update and updateChaches occured on Timeline bound to this datasource. The same exception happens (not always) when Timeline.setResolution() method is fired.
	As far as I dig the problem is in CalendarView.js in tagDataForOverlap() method:
	more precisely those lines:
	are making problem because oProps.nextValidSnap and oProps.lastValidSnap object properties seems to be null.
I hope above information is enough to help resolve this issue.
Thanks,
MichalG
 
							
						
					FF 24.8.0, Chrominium 38.0.2125.101 (290379) (64-bit) on Gentoo linux
Hi,
The following exception is thrown when Timeline refreshes itself for various reasons, for example when event start date is changed via datasource update and updateChaches occured on Timeline bound to this datasource. The same exception happens (not always) when Timeline.setResolution() method is fired.
Code:
	
	15:16:41.969:XRP8:WARN:Log:Uncaught exception escaped: com.google.gwt.core.client.JavaScriptException
(TypeError)
 __gwt$exception: <skipped>: Cannot read property 'index' of undefined
    at isc.TimelineView.addProperties.tagDataForOverlap(http://localhost:8080/app/sc/client/widgets/CalendarView.js@109:5750)
    at isc.CalendarView.addProperties.refreshEvents(http://localhost:8080/app/sc/client/widgets/CalendarView.js@14:3535)
    at isc_c_Class_invokeSuper(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@93:273)
    at isc_c_Class_Super(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@170:265)
    at isc.TimelineView.addProperties.refreshEvents(http://localhost:8080/app/sc/client/widgets/CalendarView.js@21:6011)
    at isc.Calendar.addProperties.refreshSelectedView(http://localhost:8080/app/sc/client/widgets/Calendar.js@27:3085)
    at isc.Calendar.addProperties.dataChanged(http://localhost:8080/app/sc/client/widgets/Calendar.js@14:3049)
    at eval(eval at isc__makeFunction (http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@122:58)
    at thunk(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@28:316)
    at observation(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@378:313)
    at isc_ResultSet__doneChangingData(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@29:1928)
    at isc_ResultSet_handleUpdate(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@33:1926)
    at isc_ResultSet_dataSourceDataChanged(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@6:1923)
    at eval(eval at isc__makeFunction (http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@122:58)
    at thunk(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@28:316)
    at observation(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@378:313)
    at isc_DataSource_updateCaches(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@6:498)
    at isc_c_DataSource_handleUpdate(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@153:280)
    at isc_DataSource_fireResponseCallbacks(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@460:727)
    at isc_DataSource__completeResponseProcessing(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@6:726)
    at isc_DataSource_processResponse(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@6:586)
    at $processResponse(pl.com.tech4.app-0.js@10:12016)
    at execute_38(pl.com.tech4.app-0.js@37:53276)
    at <anonymous>(pl.com.tech4.app-0.js@16:15864)
    at apply_0(pl.com.tech4.app-0.js@23:679)
    at entry0(pl.com.tech4.app-0.js@16:746)
    at <anonymous>(pl.com.tech4.app-0.js@14:728)
    at isc_c_Class_fireCallback(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@104:282)
    at isc_Class_fireCallback(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@302:350)
    at isc_c_RPCManager_fireReplyCallback(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@77:1678)
    at $wnd.isc.RPCManager.fireReplyCallback(pl.com.tech4.app-0.js@19:10032)
    at isc_c_RPCManager_fireReplyCallbacks(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@128:1683)
    at isc_c_RPCManager_performOperationReply(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@131:1676)
    at isc_c_RPCManager__performTransactionReply(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@6:1661)
    at isc_c_RPCManager_performTransactionReply(http://localhost:8080/app/sc/modules/ISC_DataBinding.js?version=REL-1.8.0@20:1585)
    at eval(eval at isc__makeFunction (http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@122:58)
    at isc_c_Class_fireCallback(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@104:282)
    at isc_c_Comm_performXmlTransactionReply(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@27:1382)
    at eval(eval at isc__makeFunction (http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@122:58)
    at isc_c_Class_fireCallback(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@104:282)
    at isc_c_Comm__fireXMLCallback(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@409:1362)
    at _15(http://localhost:8080/app/sc/modules/ISC_Core.js?version=REL-1.8.0@314:1370)
Code:
	
	    tagDataForOverlap : function (data, lane) {
        data = data || this.getEventData();
        if (data.getLength() == 0) return;
        var addLogs = false;
        var cal = this.calendar;
       
        if (cal.eventAutoArrange == false) return;
        this.forceDataSort(data);
        var useLanes = this.isTimelineView() || (this.isDayView() && cal.showDayLanes);
        var olRanges = this.updateOverlapRanges(data);
        var rangeSort = [];
        if (useLanes) {
            rangeSort.add({ property: cal.laneNameField, direction: "ascending" });
        }
        if (cal.overlapSortSpecifiers) {
            rangeSort.addList(cal.overlapSortSpecifiers);
        } else {
           
            rangeSort.add({ property: "eventLength", direction: "descending" });
            rangeSort.add({ property: cal.startDateField, direction: "ascending" });
            rangeSort.add({ property: cal.endDateField, direction: "ascending" });
        }
        if (addLogs) {
            this.logWarn("tagDataForOverlap: about to loop over " + olRanges.length + " overlap ranges");
        }
       
        for (var j = 0; j<olRanges.length; j++) {
            var range = olRanges[j];
           
            if (addLogs) {
                this.logWarn("range: " + isc.echoFull(range) + "");
            }
            var rangeStartSnapObj = this.getSnapData(null, null, range.startDate);
            var rangeStartSnap = rangeStartSnapObj ? rangeStartSnapObj.index : 0;
            var rangeEndSnapObj = this.getSnapData(null, null, range.endDate);
            var rangeEndSnap = rangeEndSnapObj ? rangeEndSnapObj.index : this._snapGapList.length-1;
           
            var rangeSnapCount = rangeEndSnap-rangeStartSnap;
            var slotCount = 1;
            var slotList = [];
            // add an initial slot
            slotList[0] = this.getOverlapSlot(0, rangeSnapCount);
            var events = range.events;
           
            events.setSort(rangeSort);
            for (var eventIndex=0; eventIndex<events.length; eventIndex++) {
                var event = events[eventIndex];
               
                event._overlapProps = {};
               
                var oProps = event._overlapProps;
                // get the event's snapGapList - last param will return the first/last snaps
                // if the dates are out of range
                oProps.eventStartSnap = this.getSnapData(null, null, event.startDate, true);
                oProps.eventEndSnap = this.getSnapData(null, null, event.endDate, true);
                // deal with hidden snaps - if eventStart/EndSnap aren't set, use last/nextValidSnap
                var eStartSnap = (oProps.eventStartSnap ? oProps.eventStartSnap.index : oProps.nextValidSnap.index) -rangeStartSnap;
                var eEndSnap = (oProps.eventEndSnap ? oProps.eventEndSnap.index : oProps.lastValidSnap.index) -rangeStartSnap;
                var found = false;
                var slot = null;
                for (var slotIndex=0; slotIndex<slotCount; slotIndex++) {
                    var gaps = slotList[slotIndex].snapGaps.slice(eStartSnap, eEndSnap);
                    var used = gaps.sum() > 0;
                    if (!used) {
                        found = true;
                        slotList[slotIndex].snapGaps.fill(1, eStartSnap, eEndSnap);
                        slotList[slotIndex].events.add(event);
                        event._overlapProps.slotNum = slotIndex
                        if (addLogs) {
                            this.logWarn("event " + event.name + " occupying slot " + slotIndex);
                        }
                        break;
                    }
                }
                if (!found) {
                    // add a new slot
                    slotList[slotCount] = this.getOverlapSlot(slotCount, rangeSnapCount);
                    slotList[slotCount].snapGaps.fill(1, eStartSnap, eEndSnap);
                    slotList[slotCount].events.add(event);
                    event._overlapProps.slotNum = slotCount
                    if (addLogs) {
                        this.logWarn("event " + event.name + " added to new slot index " + slotCount);
                    }
                    slotCount++;
                }
            }
           
            for (var i=0; i<slotList.length; i++) {
                var slot = slotList[i];
                // for each event in this slot, check all later slots - if one has an event
                // that overlaps this event directly, this event ends in the slot before -
                // decides this event's slotCount
                for (var eIndex=0; eIndex < slot.events.length; eIndex++) {
                    var event = slot.events[eIndex];
                    var oProps = event._overlapProps;
                   
                    // update the totalSlots
                    oProps.totalSlots = slotCount;
                    // get the event snapGaps
                    var eStartSnap = (oProps.eventStartSnap ? oProps.eventStartSnap.index:0) -rangeStartSnap;
                    var eEndSnap = (oProps.eventEndSnap ? oProps.eventEndSnap.index:0) -rangeStartSnap;
                   
                    var found = false;
                   
                    for (var innerIndex=i+1; innerIndex<slotList.length; innerIndex++) {
                        var gaps = slotList[innerIndex].snapGaps.slice(eStartSnap, eEndSnap);
                        var used = gaps.sum() > 0;
                        if (used) {
                            oProps.slotCount = innerIndex - oProps.slotNum;
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        // should span all following slots
                        oProps.slotCount = slotCount - oProps.slotNum;
                    }
                    // we want slotNum to start from 1, for legacy downstream code
                    oProps.slotNum++;
                    event._slotNum = oProps.slotNum;
                }
            }
           
            range.slotList = slotList;
            if (addLogs) {
                this.logWarn("***** slotList *****\n" + isc.echoFull(slotList));
            }
        }
    },
Code:
	
	// deal with hidden snaps - if eventStart/EndSnap aren't set, use last/nextValidSnap var eStartSnap = (oProps.eventStartSnap ? oProps.eventStartSnap.index : oProps.nextValidSnap.index) -rangeStartSnap; var eEndSnap = (oProps.eventEndSnap ? oProps.eventEndSnap.index : oProps.lastValidSnap.index) -rangeStartSnap;
I hope above information is enough to help resolve this issue.
Thanks,
MichalG

Comment