Announcement

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

    [BUG]: Timeline events with datasource with sparseupdates (Example included)

    Using version: v110p_2016-08-22_LGPL

    Problem
    If you bind a datasource with sparseupdates to the timeline, and update an event, the displaying of the events will fail and handleMouseMove fails on getDateFromPoint.

    My observations
    This only happens with sparseupdates=true; If you debug the timelineview.body.fields you will see a change in the array after the call to _applySparseAndNoNullUpdates in ISC_Databindings.js. Hope this helps, didn't have time to investigate this further (it took some time to find out this issue only occured using sparseupdates).

    Reproduce
    Past the following code in the timefiltering.js TAB of the following URL: http://www.smartclient.com/smartclie...elineFiltering
    Please drag event 2 to the right and see the result.

    Code:
    var developers = [
        { name: "darcyFeeney", title: "Darcy Feeney"},
        { name: "kaiKong", title: "Kai Kong"}
    ];
    
    var _calStart = isc.DateUtil.getStartOf(new Date(2012, 6, 5), "W");
    var _calEnd = _calStart.duplicate();
    _calEnd.setDate(_calEnd.getDate() + 20);
    
    var ds = isc.DataSource.create({
      clientOnly:true,
      sparseUpdates:true,
      fields:[{
    name:'eventId',primaryKey:true
    }],
    cacheData:[
    
    {
        eventId: 1, 
        name: "Add new Timeline view",
        description: "Add a new calendar Timeline component",
        startDate: new Date(_year, _month, _start + 2),
        endDate: isc.DateUtil.getEndOf(new Date(_year, _month, _start + 8), "D"),
        lane: "darcyFeeney"
    },
    {
        eventId: 2,
        name: "ListGrid field autoSize",
        description: "Complex field-autosizing in ListGrid",
        startDate: new Date(_year, _month, _start),
        endDate: isc.DateUtil.getEndOf(new Date(_year, _month, _start), "D"),
        lane: "kaiKong"
    }]
    })
    
    
    isc.Timeline.create({
        ID: "timeline", 
        top: 50,
        height: 451,
        startDate: _calStart, 
        endDate: _calEnd,
    autoFetchData:true,
    dataSource:ds,
        lanes: developers,
        headerLevels: [ { unit: "week" }, { unit: "day" } ],
        laneFields: [ { name: "title", title: "Developer", width: 120 }],
        canEditLane: true,
        showEventDescriptions: false,
        columnsPerPage: 5,
        disableWeekends: false,
        laneEventPadding: 2
    });

    #2
    You need to declare startDate and endDate as fields in your DataSource. Otherwise they will be removed by sparseUpdates, and this is correct behavior.

    Comment


      #3
      I have this in my production, but the issue remains.

      See this updated example:
      Code:
      var developers = [
          { name: "darcyFeeney", title: "Darcy Feeney"},
          { name: "kaiKong", title: "Kai Kong"}
      ];
      
      var _calStart = isc.DateUtil.getStartOf(new Date(2012, 6, 5), "W");
      var _calEnd = _calStart.duplicate();
      _calEnd.setDate(_calEnd.getDate() + 20);
      
      var ds = isc.DataSource.create({
        clientOnly:true,
        sparseUpdates:true,
        fields:[{
      name:'eventId',primaryKey:true
      },{
      name:'startDate',type:'datetime'
      },{
      name:'endDate',type:'datetime'
      }],
      cacheData:[
      
      {
          eventId: 1, 
          name: "Add new Timeline view",
          description: "Add a new calendar Timeline component",
          startDate: new Date(_year, _month, _start + 2),
          endDate: isc.DateUtil.getEndOf(new Date(_year, _month, _start + 8), "D"),
          lane: "darcyFeeney"
      },
      {
          eventId: 2,
          name: "ListGrid field autoSize",
          description: "Complex field-autosizing in ListGrid",
          startDate: new Date(_year, _month, _start),
          endDate: isc.DateUtil.getEndOf(new Date(_year, _month, _start), "D"),
          lane: "kaiKong"
      }]
      })
      
      
      isc.Timeline.create({
          ID: "timeline", 
          top: 50,
          height: 451,
          startDate: _calStart, 
          endDate: _calEnd,
      autoFetchData:true,
      dataSource:ds,
          lanes: developers,
          headerLevels: [ { unit: "week" }, { unit: "day" } ],
          laneFields: [ { name: "title", title: "Developer", width: 120 }],
          canEditLane: true,
          showEventDescriptions: false,
          columnsPerPage: 5,
          disableWeekends: false,
          laneEventPadding: 2
      });

      Comment


        #4
        We see the issue and it's queued to be looked into - we'll update here in the coming days.

        Comment


          #5
          I have an update: apparently Timeline adds an property (_overlapProps, type Object) to the record which is copied to the updateRecord. Because of the recursive behaviour of _applySparseAndNoNullUpdates it removes properties of the Timeline internal state. Applying some clean record method should suffice.

          ISC_Calendar.js@11201:
          Code:
                  var updatedRecord = isc.addProperties({}, newEvent, otherFields);
                  var _this = this;
                  // Ugly hack: 
                  delete updatedRecord._overlapProps;
                  // something like isc.Calendar.cleanRecord(updatedRecord) would be cool
                  ds.updateData(updatedRecord, function (dsResponse, data, dsRequest) {
                      _this.processSaveResponse(dsResponse, data, dsRequest, event);
                  }, {oldValues: event, componentId: this.ID, willHandleError: true});

          Comment


            #6
            Yes, we noticed that also - thanks for the clarification, we'll update here when it's been addressed.

            Comment


              #7
              This is addressed for builds dated August 25 and later.

              Comment


                #8
                Great! thanks for your quick response and resolve.

                Comment

                Working...
                X