Announcement

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

    Timeline.tagDataForOverlap() - Cannot read property 'index' of undefined

    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.

    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)
    As far as I dig the problem is in CalendarView.js in tagDataForOverlap() method:
    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));
                }
            }
        },
    more precisely those lines:
    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;
    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

    #2
    We need to see a test-case that shows how the timeline gets into this bad state (start and end dates, granularity, eventSsnapGap and many other settings are important).

    Comment


      #3
      That "bed state" is closely related with upgrade to 6.0p (from 5.1p which was fine).
      Any hints I should look for? Preparing test case from that will take hours (or days).
      MichalG

      Comment


        #4
        Ok, here you are:
        Running the following sample code:
        Code:
        package pl.com.tech4.client;
        
        import com.google.gwt.core.client.EntryPoint;
        import com.google.gwt.user.client.DOM;
        import com.smartgwt.client.data.DataSource;
        import com.smartgwt.client.data.DataSourceField;
        import com.smartgwt.client.data.OperationBinding;
        import com.smartgwt.client.data.fields.DataSourceDateTimeField;
        import com.smartgwt.client.data.fields.DataSourceTextField;
        import com.smartgwt.client.types.DSDataFormat;
        import com.smartgwt.client.types.DSOperationType;
        import com.smartgwt.client.types.DSProtocol;
        import com.smartgwt.client.util.SC;
        import com.smartgwt.client.widgets.calendar.Lane;
        import com.smartgwt.client.widgets.calendar.Timeline;
        
        public class MainEntryPoint implements EntryPoint {
           
            public void onModuleLoad() {
        
                DOM.getElementById("loadingPicture").removeFromParent();
                layout();
                SC.showConsole();
            }
           
            private void layout() {
        
                OperationBinding fetchBinding = new OperationBinding();
                fetchBinding.setOperationType(DSOperationType.FETCH);
                fetchBinding.setDataFormat(DSDataFormat.XML);
                fetchBinding.setDataProtocol(DSProtocol.POSTXML);
               
                DataSource projectDS = new DataSource();
                projectDS.setID("Project");
                projectDS.setOperationBindings(fetchBinding);
                projectDS.setDataURL("Project.xml");
               
                DataSourceField idField = new DataSourceField();
                idField.setName("id");
                idField.setPrimaryKey(true);
                idField.setHidden(true);
                DataSourceTextField codeField = new DataSourceTextField();
                codeField.setName("code");
                DataSourceDateTimeField validFromField = new DataSourceDateTimeField();
                validFromField.setName("validFrom");
                DataSourceDateTimeField validToField = new DataSourceDateTimeField();
                validToField.setName("validTo");
                DataSourceField managerField = new DataSourceField();
                managerField.setName("manager");
                managerField.setValueXPath("manager/id");
                projectDS.setFields(idField, codeField, validFromField, validToField, managerField);
                
                Lane[] lanes = new Lane[1];
                lanes[0] = new Lane("351", "michalg");
        
                Timeline timeline = new Timeline();
                timeline.setStartDateField("validFrom");
                timeline.setEndDateField("validTo");
                timeline.setLaneNameField("manager");
                timeline.setLanes(lanes);
                timeline.setDataSource(projectDS);
                timeline.setAutoFetchData(true);
                
                timeline.draw();
            }
           
        }
        using the following data Project.xml
        Code:
        <response>
            <requestId>Project$62749</requestId>
            <startRow>0</startRow>
            <endRow>2</endRow>
            <totalRows>2</totalRows>
            <data>
                <Project>
                    <id>34872</id>
                    <code>r/16</code>
                    <description>remont</description>
                    <validFrom>2016-04-10T12:00:00Z</validFrom>
                    <validTo>2016-10-07T12:00:00Z</validTo>
                    <manager>
                        <id>351</id>
                        <code>michalg</code>
                        <personalData>
                            <lastName>Gronkowski</lastName>
                            <firstName>Michał</firstName>
                            <title>sir</title>
                        </personalData>
                    </manager>
                </Project>
                <Project>
                    <id>36548</id>
                    <code>r/16/1</code>
                    <description>remont dachu</description>
                    <validFrom>2016-04-27T12:00:00Z</validFrom>
                    <validTo>2016-05-27T12:00:00Z</validTo>
                    <manager>
                        <id>351</id>
                        <code>michalg</code>
                        <personalData>
                            <lastName>Gronkowski</lastName>
                            <firstName>Michał</firstName>
                            <title>sir</title>
                        </personalData>
                    </manager>
                </Project>
            </data>
            <requestedDataSource>Project</requestedDataSource>
            <status>STATUS_SUCCESS</status>
        </response>
        Throws this ex:
        Code:
        16:21:30.356:WARN:Timeline:isc_Timeline_0:Specified field 'undefined' is not present in the DataSource and no suitable alternative was auto-detected.
        16:21:31.264:XRP2:WARN:Log:TypeError: Cannot read property 'index' of undefined
        Stack from error.stack:
            TimelineView.tagDataForOverlap(<no args: exited>) on [TimelineView ID:isc_Timeline_0_timelineView] @ ISC_Calendar.js:319:548
            CalendarView.refreshEvents(<no args: exited>) on [TimelineView ID:isc_Timeline_0_timelineView] @ ISC_Calendar.js:206:28
            [c]Class.invokeSuper(<no args: exited>) on [TimelineView ID:isc_Timeline_0_timelineView] @ ISC_Core.js:273:93
            [c]Class.Super(<no args: exited>) on [TimelineView ID:isc_Timeline_0_timelineView] @ ISC_Core.js:265:170
            TimelineView.refreshEvents(<no args: exited>) on [TimelineView ID:isc_Timeline_0_timelineView] @ ISC_Calendar.js:344:312
            Calendar.refreshSelectedView(<no args: exited>) on [Timeline ID:isc_Timeline_0] @ ISC_Calendar.js:448:1408
            Calendar.dataChanged(<no args: exited>) on [Timeline ID:isc_Timeline_0] @ ISC_Calendar.js:448:161
            eval(<no args: exited>) on [ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)] @ [no file]:4:10
            thunk(<no args: exited>) on [Timeline ID:isc_Timeline_0] @ ISC_Core.js:316:28
            observation(<no args: exited>) on [ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)] @ ISC_Core.js:313:378
            ResultSet._doneChangingData(<no args: exited>) on [ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)] @ ISC_DataBinding.js:1928:29
            ResultSet._handleNewData(<no args: exited>) on [ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)] @ ISC_DataBinding.js:1885:6
            fetchRemoteDataReply(<no args: exited>) on [ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)] @ ISC_DataBinding.js:1871:103
            [c]Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>[ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)], _5=>undef) on [Class DataSource] @ ISC_Core.js:282:104
            Class.fireCallback(_1=>Obj, _2=>"dsResponse,data,dsRequest", _3=>Array[3], _4=>undef) on [DataSource ID:Project] @ ISC_Core.js:350:302
            DataSource.fireResponseCallbacks(_1=>Obj, _2=>Obj, _3=>Obj, _4=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:728:89
            DataSource._completeResponseProcessing(_1=>[XMLDoc <response>], _2=>Obj, _3=>Obj, _4=>Obj, _5=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:726:6
            DataSource._completeHandleXMLReply(_1=>Obj, _2=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:703:261
            [c]Class.fireCallback(<no args: recursion>)  on [Class DataSource] @ ISC_Core.js:282:104
            Class.fireCallback(<no args: recursion>)  on [DataSource ID:Project] @ ISC_Core.js:350:302
            DataSource._completeDSResponseFromXML(_1=>Array[2], _2=>Obj, _3=>undef, _4=>undef) on [DataSource ID:Project] @ ISC_DataBinding.js:708:12
            [c]Class.fireCallback(<no args: recursion>)  on [Class DataSource] @ ISC_Core.js:282:104
            Class.fireCallback(<no args: recursion>)  on [DataSource ID:Project] @ ISC_Core.js:350:302
            DataSource.recordsFromXML(_1=>Array[2], _2=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:712:13
            DataSource.selectRecords(_1=>[XMLDoc <response>], _2=>Obj, _3=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:709:213
            DataSource.dsResponseFromXML(_1=>[XMLDoc <response>], _2=>Obj, _3=>Obj, _4=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:703:415
            DataSource._handleXMLReply(_1=>[XMLDoc <response>], _2=>"<response>\n    <requestId>Project$62749<..."[1390], _3=>Obj, _4=>Obj) on [DataSource ID:Project] @ ISC_DataBinding.js:703:75
            [c]Class.fireCallback(<no args: recursion>)  on [Class XMLTools] @ ISC_Core.js:282:104
            $37c(_1=>Obj, _2=>"<response>\n    <requestId>Project$62749<..."[1390], _3=>Obj) on [Class XMLTools] @ ISC_DataBinding.js:51:6
            [c]Class.fireCallback(<no args: recursion>)  on [Class RPCManager] @ ISC_Core.js:282:104
            Class.fireCallback(<no args: recursion>)  on [RPCManager ID:builtinApplication] @ ISC_Core.js:350:302
            RPCManager.fireReplyCallback(_1=>Obj, _2=>Obj, _3=>Obj, _4=>"<response>\n    <requestId>Project$62749<..."[1390]) on [Class RPCManager] @ ISC_DataBinding.js:1678:77
            fireReplyCallback(callback=>Obj, request=>Obj, response=>Obj, data=>"<response>\n    <requestId>Project$62749<..."[1390]) on [Class RPCManager] @ [no file]:2745:19
            [c]RPCManager.fireReplyCallbacks(_1=>Obj, _2=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:1683:128
            [c]RPCManager.performOperationReply(_1=>Obj, _2=>Obj) on [Class RPCManager] @ ISC_DataBinding.js:1676:131
            RPCManager._performTransactionReply(_1=>1) on [Class RPCManager] @ ISC_DataBinding.js:1661:6
            [c]RPCManager.performTransactionReply(_1=>1, _2=>"<response>\n    <requestId>Project$62749<..."[1390], _3=>undef) on [Class RPCManager] @ ISC_DataBinding.js:1585:20
            eval(transactionNum=>1, results=>[object XMLHttpRequest], wd=>undef) @ [no file]:3:16
            [c]Class.fireCallback(<no args: recursion>)  on [Class Comm] @ ISC_Core.js:282:104
            [c]Comm.performXmlTransactionReply(_1=>1, _2=>[object XMLHttpRequest]) on [Class Comm] @ ISC_Core.js:1382:27
            eval(xmlHttpRequest=>[object XMLHttpRequest]) @ [no file]:3:10
            [c]Class.fireCallback(<no args: recursion>)  on [Class Class] @ ISC_Core.js:282:104
            Comm._fireXMLCallback(_1=>[object XMLHttpRequest], _2=>"isc.Comm.performXmlTransactionReply(1, x..."[54], _3=>undef) on [Class Comm] @ ISC_Core.js:1362:409
            XMLHttpRequest._15() @ ISC_Core.js:1370:314
        using SmartClient Version: v11.0p_2016-05-03/LGPL Development Only (built 2016-05-03)

        Moreover, RPC console shows 2 identical fetch requests:
        Code:
        {
            dataSource:"Project",
            operationType:"fetch",
            componentId:"isc_Timeline_0",
            data:{
                operator:"and",
                criteria:[
                    {
                        fieldName:"validFrom",
                        operator:"lessThan",
                        value:"2016-05-31T21:59:59.999"
                    },
                    {
                        fieldName:"validTo",
                        operator:"greaterThan",
                        value:"2016-05-10T22:00:00.000"
                    }
                ]
            },
            startRow:0,
            endRow:75,
            textMatchStyle:"exact",
            resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)],
            callback:{
                caller:[ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)],
                methodName:"fetchRemoteDataReply"
            },
            willHandleError:true,
            showPrompt:true,
            prompt:"Wyszukiwanie rekordów odpowiadających kryteriom...",
            requestId:"Project$6270",
            internalClientContext:{
                requestIndex:1
            },
            fallbackToEval:false,
            bypassCache:true,
            dataProtocol:"postXML"
        }
        both requesting startRow=0, endRow=75

        Can you have a look into this issue again, please?
        MichalG

        Comment


          #5
          Your issue is almost certainly that your DS has no "name" field. Just add one, or assign your "code" field as the Calendar's nameField. Check the CalendarEvent docs.
          Last edited by Isomorphic; 11 May 2016, 07:06.

          Comment


            #6
            You also need to give your PK field a type.

            Comment


              #7
              Thanks for those hints.
              Neither setting type for PK idField, nor setting timeline.setNameField("code") resolve problem.
              I also have tried adding additional "name" field with no luck.
              The very same exception after running following modified code:
              Code:
              package pl.com.tech4.client;
              
              import com.google.gwt.core.client.EntryPoint;
              import com.google.gwt.user.client.DOM;
              import com.smartgwt.client.data.DataSource;
              import com.smartgwt.client.data.DataSourceField;
              import com.smartgwt.client.data.OperationBinding;
              import com.smartgwt.client.data.fields.DataSourceDateTimeField;
              import com.smartgwt.client.data.fields.DataSourceTextField;
              import com.smartgwt.client.types.DSDataFormat;
              import com.smartgwt.client.types.DSOperationType;
              import com.smartgwt.client.types.DSProtocol;
              import com.smartgwt.client.types.FieldType;
              import com.smartgwt.client.util.SC;
              import com.smartgwt.client.widgets.calendar.Lane;
              import com.smartgwt.client.widgets.calendar.Timeline;
              import java.util.Date;
              
              public class MainEntryPoint implements EntryPoint {
                 
                  public void onModuleLoad() {
              
                      DOM.getElementById("loadingPicture").removeFromParent();
                      layout();
                      SC.showConsole();
                  }
                 
                  private void layout() {
              
                      OperationBinding fetchBinding = new OperationBinding();
                      fetchBinding.setOperationType(DSOperationType.FETCH);
                      fetchBinding.setDataFormat(DSDataFormat.XML);
                      fetchBinding.setDataProtocol(DSProtocol.POSTXML);
                     
                      DataSource projectDS = new DataSource();
                      projectDS.setID("Project");
                      projectDS.setOperationBindings(fetchBinding);
                      projectDS.setDataURL("Project.xml");
                     
                      DataSourceField idField = new DataSourceField();
                      idField.setType(FieldType.SEQUENCE);
                      idField.setName("id");
                      idField.setPrimaryKey(true);
                      idField.setHidden(true);
                      DataSourceTextField codeField = new DataSourceTextField();
                      codeField.setName("code");
              //        DataSourceTextField nameField = new DataSourceTextField();
              //        nameField.setName("name");
                      DataSourceDateTimeField validFromField = new DataSourceDateTimeField();
                      validFromField.setName("validFrom");
                      DataSourceDateTimeField validToField = new DataSourceDateTimeField();
                      validToField.setName("validTo");
                      DataSourceField managerField = new DataSourceField();
                      managerField.setName("manager");
                      managerField.setValueXPath("manager/id");
                      projectDS.setFields(idField, codeField, /*nameField,*/ validFromField, validToField, managerField);
                      
                      Lane[] lanes = new Lane[1];
                      lanes[0] = new Lane("351", "michalg");
              
                      Timeline timeline = new Timeline();
                      timeline.setNameField("code");
                      timeline.setStartDateField("validFrom");
                      timeline.setEndDateField("validTo");
                      timeline.setStartDate(new Date(116, 5, 2));  
                      timeline.setEndDate(new Date(116, 5, 22));
                      timeline.setLaneNameField("manager");
                      timeline.setLanes(lanes);
                      timeline.setDataSource(projectDS);
                      timeline.setAutoFetchData(true);
                      
                      timeline.draw();
                  }
                 
              }

              Comment


                #8
                You didn't show your XML file - does it have data already? If not, how are you creating data?

                If you make your DS a straight clientOnly: true DS, with no dataURL or opBindings, does that work?

                Comment


                  #9
                  Originally posted by Isomorphic View Post
                  You didn't show your XML file - does it have data already?
                  I did: Project.xml in post #4

                  Comment


                    #10
                    Originally posted by Isomorphic View Post
                    If you make your DS a straight clientOnly: true DS, with no dataURL or opBindings, does that work?
                    I am not sure what you mean by "no dataURL", but clientOnly and no opBindings does not help.
                    I also noticed that if star/endDate are initially set to range where no event exists, and then one changes date to current via calendar widget, there is no error and events are displayed. If range initially is set ~today, you got exception and no events visible.
                    Code:
                    package pl.com.tech4.client;
                    
                    import com.google.gwt.core.client.EntryPoint;
                    import com.google.gwt.user.client.DOM;
                    import com.smartgwt.client.data.DataSource;
                    import com.smartgwt.client.data.DataSourceField;
                    import com.smartgwt.client.data.fields.DataSourceDateTimeField;
                    import com.smartgwt.client.data.fields.DataSourceTextField;
                    import com.smartgwt.client.types.FieldType;
                    import com.smartgwt.client.util.SC;
                    import com.smartgwt.client.widgets.calendar.Lane;
                    import com.smartgwt.client.widgets.calendar.Timeline;
                    import java.util.Date;
                    
                    public class MainEntryPoint implements EntryPoint {
                       
                        public void onModuleLoad() {
                    
                            DOM.getElementById("loadingPicture").removeFromParent();
                            layout();
                            SC.showConsole();
                        }
                       
                        private void layout() {
                    
                            DataSource projectDS = new DataSource();
                            projectDS.setID("Project");
                            projectDS.setDataURL("Project.xml");
                            projectDS.setClientOnly(true);
                           
                            DataSourceField idField = new DataSourceField();
                            idField.setType(FieldType.SEQUENCE);
                            idField.setName("id");
                            idField.setPrimaryKey(true);
                            idField.setHidden(true);
                            DataSourceTextField codeField = new DataSourceTextField();
                            codeField.setName("code");
                    //        DataSourceTextField nameField = new DataSourceTextField();
                    //        nameField.setName("name");
                            DataSourceDateTimeField validFromField = new DataSourceDateTimeField();
                            validFromField.setName("validFrom");
                            DataSourceDateTimeField validToField = new DataSourceDateTimeField();
                            validToField.setName("validTo");
                            DataSourceField managerField = new DataSourceField();
                            managerField.setName("manager");
                            managerField.setValueXPath("manager/id");
                            projectDS.setFields(idField, codeField, /*nameField,*/ validFromField, validToField, managerField);
                            
                            Lane[] lanes = new Lane[1];
                            lanes[0] = new Lane("351", "michalg");
                    
                            Timeline timeline = new Timeline();
                            timeline.setNameField("code");
                            timeline.setStartDateField("validFrom");
                            timeline.setEndDateField("validTo");
                            timeline.setStartDate(new Date(116, 5, 2));  
                            timeline.setEndDate(new Date(116, 5, 22));
                            timeline.setLaneNameField("manager");
                            timeline.setLanes(lanes);
                            timeline.setDataSource(projectDS);
                            timeline.setAutoFetchData(true);
                            
                            timeline.draw();
                        }
                       
                    }
                    Project.xml
                    Code:
                    <list>
                        <Project>
                            <id>34872</id>
                            <code>r/16</code>
                            <description>remont</description>
                            <validFrom>2016-04-10T12:00:00Z</validFrom>
                            <validTo>2016-10-07T12:00:00Z</validTo>
                            <manager>
                                <id>351</id>
                                <code>michalg</code>
                                <personalData>
                                    <lastName>Gronkowski</lastName>
                                    <firstName>Michał</firstName>
                                    <title>sir</title>
                                </personalData>
                            </manager>
                        </Project>
                        <Project>
                            <id>36548</id>
                            <code>r/16/1</code>
                            <description>remont dachu</description>
                            <validFrom>2016-04-27T12:00:00Z</validFrom>
                            <validTo>2016-05-27T12:00:00Z</validTo>
                            <manager>
                                <id>351</id>
                                <code>michalg</code>
                                <personalData>
                                    <lastName>Gronkowski</lastName>
                                    <firstName>Michał</firstName>
                                    <title>sir</title>
                                </personalData>
                            </manager>
                        </Project>
                    </list>

                    Comment


                      #11
                      Ok, this is fixed for builds dated May 13 and later - there was an instance of logic that assumed the start and end date fields were called startDate and endDate, which they aren't in your case.

                      Comment


                        #12
                        I have just verified that it is fixed, both in my sample and in my real app.
                        Thanks a lot.
                        Just one thing that still bothers me. By default Timeline generates fetch request specifying start and endRow:
                        Code:
                        {
                            dataSource:"Project",
                            operationType:"fetch",
                            componentId:"isc_Timeline_0",
                            data:{
                                operator:"and",
                                criteria:[
                                    {
                                        fieldName:"validFrom",
                                        operator:"lessThan",
                                        value:"2016-07-11T21:59:59.998"
                                    },
                                    {
                                        fieldName:"validTo",
                                        operator:"greaterThan",
                                        value:"2016-06-21T22:00:00.000"
                                    }
                                ]
                            },
                            startRow:0,
                            endRow:75,
                            textMatchStyle:"exact",
                            resultSet:[ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)],
                            callback:{
                                caller:[ResultSet ID:isc_ResultSet_0 (dataSource: Project, created by: isc_Timeline_0)],
                                methodName:"fetchRemoteDataReply"
                            },
                            willHandleError:true,
                            showPrompt:true,
                            prompt:"Wyszukiwanie rekordów odpowiadających kryteriom...",
                            requestId:"Project$6272",
                            internalClientContext:{
                                requestIndex:3
                            },
                            fallbackToEval:false,
                            lastClientEventThreadCode:"MUP7",
                            bypassCache:true,
                            clientOnly:true,
                            dataProtocol:"clientOnly"
                        }
                        To me, Timeline needs all events for given period at once to render them correctly, right?
                        So if I have range (resolution) set to say, two years, then I likely got not all events for this range.
                        I would presume that paging in Timeline should be turned off by default. At least I set:
                        timeline.setDataFetchMode(FetchMode.BASIC);
                        Thanks,
                        MichalG

                        Comment

                        Working...
                        X