如何在两个链接的时间轴之间拖动项目?

时间:2018-07-17 13:10:18

标签: javascript vue.js vuejs2 vis.js vis.js-timeline

我有两个链接的时间轴,所以我想知道的是在这两个时间轴之间拖动项目。

第一个时间轴是Queue,第二个时间轴是我的Main Timeline。因此,我想让我可以将项目从Queue拖放到Main timeline,反之亦然。

这是我的两条时间表。

enter image description here

主要时间轴选项:

var options = {
    onMove: function (item, callback) {
      console.log('content', item)
    },
    onAdd: function (item, callback) {
      console.log(item)
      callback(item)
    },
    start: new Date(),
    end: new Date(1000 * 60 * 60 * 24 + (new Date()).valueOf()),
    min: new Date(2018, 0, 1),
    max: new Date(2019, 0, 1),
    zoomMin: 1000 * 27 * 24 * 24, // if you want to zoom more in then lower the 27
    zoomMax: 1000 * 60 * 60 * 24 * 31 * 3,
    stack: false,
    showMajorLabels: false, // hide date
    showMinorLabels: false, // hide time
    autoResize: true,
    orientation: 'top',
    editable: {
      add: true,
      updateTime: true,
      updateGroup: true,
      overrideItems: false,
      remove: true
    }
  }
  this.mainTimeline = new visTimeline.Timeline(container)
  this.mainTimeline.setOptions(options)
  this.mainTimeline.setGroups(groups)
  this.mainTimeline.setItems(items)
  this.mainTimeline.on('rangechange', function (properties) {
    self.mainProperties = properties
})

队列选项:

var options = {
    onMove: function (item, callback) {
      console.log('content', item)
    },
    start: new Date(),
    end: new Date(1000 * 60 * 60 * 24 + (new Date()).valueOf()),
    min: new Date(2018, 0, 1),
    max: new Date(2019, 0, 1),
    zoomMin: 1000 * 27 * 24 * 24, // if you want to zoom more in then lower the 27
    zoomMax: 1000 * 60 * 60 * 24 * 31 * 3,
    autoResize: true,
    orientation: 'top',
    editable: false
    // editable: {
    //   add: true,
    //   updateTime: true,
    //   updateGroup: true,
    //   overrideItems: false,
    //   remove: true
    // }
  }
  this.queueTimeline = new visTimeline.Timeline(container)
  this.queueTimeline.setOptions(options)
  this.queueTimeline.setGroups(groups)
  this.queueTimeline.setItems(items)
  this.queueTimeline.on('rangechange', function (properties) {
    self.queueProperties = properties
})

有什么解决办法吗?谢谢!

0 个答案:

没有答案