-
Notifications
You must be signed in to change notification settings - Fork 1.5k
timeline - update tooltip on onMoving callback is not working #4288
Comments
In your onMoving function, it seems you call the update method of an ItemSet outside the scope of the function.
|
Oh... indeed - thanks a lot @daRoof ; I misunderstood how vis timeline behaves, I thought I had to update the datas object first then call the callback. I changed the code into this now, and it almost work: // callBack for the Edit
onMove: function (item, callback) {
tooltip = set_Tooltip(new Date(item.start).getTime(), new Date(item.end).getTime());
item.content = set_Content( item.id, new Date(item.start).getTime() ); // Working!
console.log(item.content + tooltip);
callback(item); // send back item as confirmation (can be changed)
},
onMoving: function (item, callback) {
tooltip = set_Tooltip(new Date(item.start).getTime(), new Date(item.end).getTime());
item.title = tooltip ; // That's not updating the values of the tooltip while dragging
item.content = "moving"; // Working!
console.log(tooltip);
callback(item); // send back the (possibly) changed item
}, On the onMoving, title object is not updated, and so the tooltip which display the title is not updated on dragging. I tried to update the content at the same time, and that works. The onMoving update the content while moving the item. How can I have the tooltip updated while dragging the items on the timeline? My items are declared like this, items.add([
{id: 1, group:0, content: set_Content('1', 1920), editable: true, title: set_Tooltip(1920, 2450), start: 1920, end: 2450},
{id: 2, group:1, content: set_Content('2', 500), editable: true, title: set_Tooltip(500, 2500), start: 500, end: 2500},
{id: 3, group:3, content: set_Content('3', 3440), editable: true, title: set_Tooltip(3440, 4230), start: 3440, end: 4230},
{id: 4, group:7, content: set_Content('4', 5120), editable: true, title: set_Tooltip(5120, 6840), start: 5120, end: 6840},
{id: 5, group:0, content: set_Content('5', 520), editable: true, title: set_Tooltip(520, 1290), start: 520, end: 1290},
{id: 6, group:2, content: set_Content('6', 105), editable: true, title: set_Tooltip(105, 1230), start: 105, end: 1230}
]);
/*
setTooltip define a HTML tag formatted like this,
<div class="tag-in"><span>In</span>00:00:00:00 (0)</div><div class="tag-out"><span>Out</span>00:00:01:00 (25)</div>
*/ Thanks a lot for the help! |
Hello,
I'm trying to update the content of the items while dragging them on the timeline, but it just crash every time.
I used the code of the example
editingItemsCallbacks.html
that I modified on the option section like this:Every time I'm getting the following errors on console,
Does anyone succeed on update item values with the current version of timeline, or do I do something wrong?
Thanks
The text was updated successfully, but these errors were encountered: