src/basis/data/dataset/Slice.js
function(){
    var start = this.offset;
    var end = start + this.limit;

    if (this.orderDesc)
    {
      start = this.index_.length - end;
      end = start + this.limit;
    }

    var curSet = objectSlice(this.members_);
    var newSet = this.index_.slice(Math.max(0, start), Math.max(0, end));
    var inserted = [];
    var delta;

    for (var i = 0, item; item = newSet[i]; i++)
    {
      var objectId = item.object.basisObjectId;

      if (curSet[objectId])
        delete curSet[objectId];
      else
      {
        inserted.push(item.object);
        this.members_[objectId] = item.object;
      }
    }

    for (var objectId in curSet)
      delete this.members_[objectId];

    // update left tokens
    if (this.left_)
      for (var offset in this.left_)
      {
        var item = this.index_[this.orderDesc ? end + Number(offset) - 1 : start - Number(offset)];
        this.left_[offset].set(item ? item.object : null);
      }

    // update right tokens
    if (this.right_)
      for (var offset in this.right_)
      {
        var item = this.index_[this.orderDesc ? start - Number(offset) : end + Number(offset) - 1];
        this.right_[offset].set(item ? item.object : null);
      }

    // emit event if any delta
    if (delta = getDelta(inserted, values(curSet)))
      this.emit_itemsChanged(delta);

    return delta;
  }
function(){
    var start = this.offset;
    var end = start + this.limit;

    if (this.orderDesc)
    {
      start = this.index_.length - end;
      end = start + this.limit;
    }

    var curSet = objectSlice(this.members_);
    var newSet = this.index_.slice(Math.max(0, start), Math.max(0, end));
    var inserted = [];
    var delta;

    for (var i = 0, item; item = newSet[i]; i++)
    {
      var objectId = item.object.basisObjectId;

      if (curSet[objectId])
        delete curSet[objectId];
      else
      {
        inserted.push(item.object);
        this.members_[objectId] = item.object;
      }
    }

    for (var objectId in curSet)
      delete this.members_[objectId];

    // update left tokens
    if (this.left_)
      for (var offset in this.left_)
      {
        var item = this.index_[this.orderDesc ? end + Number(offset) - 1 : start - Number(offset)];
        this.left_[offset].set(item ? item.object : null);
      }

    // update right tokens
    if (this.right_)
      for (var offset in this.right_)
      {
        var item = this.index_[this.orderDesc ? start - Number(offset) : end + Number(offset) - 1];
        this.right_[offset].set(item ? item.object : null);
      }

    // emit event if any delta
    if (delta = getDelta(inserted, values(curSet)))
      this.emit_itemsChanged(delta);

    return delta;
  }
function ( ) { var start = this . offset ; var end = start + this . limit ; if ( this . orderDesc ) { start = this . index_ . length - end ; end = start + this . limit ; } var curSet = objectSlice ( this . members_ ) ; var newSet = this . index_ . slice ( Math . max ( 0 , start ) , Math . max ( 0 , end ) ) ; var inserted = [ ] ; var delta ; for ( var i = 0 , item ; item = newSet [ i ] ; i ++ ) { var objectId = item . object . basisObjectId ; if ( curSet [ objectId ] ) delete curSet [ objectId ] ; else { inserted . push ( item . object ) ; this . members_ [ objectId ] = item . object ; } } for ( var objectId in curSet ) delete this . members_ [ objectId ] ; // update left tokens if ( this . left_ ) for ( var offset in this . left_ ) { var item = this . index_ [ this . orderDesc ? end + Number ( offset ) - 1 : start - Number ( offset ) ] ; this . left_ [ offset ] . set ( item ? item . object : null ) ; } // update right tokens if ( this . right_ ) for ( var offset in this . right_ ) { var item = this . index_ [ this . orderDesc ? start - Number ( offset ) : end + Number ( offset ) - 1 ] ; this . right_ [ offset ] . set ( item ? item . object : null ) ; } // emit event if any delta if ( delta = getDelta ( inserted , values ( curSet ) ) ) this . emit_itemsChanged ( delta ) ; return delta ; }
Recompute slice.
@return {Object} Delta of member changes.
Recompute slice .