alexcode / vue2vis

A Vuejs 2 adapter for Visjs
MIT License
217 stars 59 forks source link

How to get start and end time on drop in vis.js timeline? #19

Closed mjelecevic closed 6 years ago

mjelecevic commented 6 years ago

I implemented the vis.js timeline in my vue.js project, but I have a problem with the drop. First of all I think the drop does not works in that library, second how can i get the start and the end time and date when I drag one item and then drop it?

Because the drop event is not working I'm trying to do it with

@items-update="itemsUpdate()"

and I'm getting the data back with.

let properties = this.$refs.timeline.getEventProperties(event)

But I'm getting the time where the mouse pointer stops.

So is there any way to get the start time and end time after drop I mean after I stop dragging the item?

Because I need to save start time and the end time into my database for that dragged item.

Thanks.

alexcode commented 6 years ago

Personally I subscribe to @drop and retrieve snappedTime out of the event. Here is a fiddle that demonstrate it: https://jsfiddle.net/alexkodo/ejdut8fm/253/