I have been using vis.js timeline to keep items in a time order.
I use the following to add timeline items :
timeline_items.add({
id : entity_id + uuidv4(),
group : "timeline_video_group_id",
start : start_date,
end : end_date,
content : "<img src='" + element_src_link + "'></img>",
className : 'imagecontainer'
});
However, I cannot add any custom data into this add function.
How may I add custom data, so it may hold information such as entity-uuid=xxxx inside the div below ?
<div class="vis-item vis-range imagecontainer vis-editable" style="transform...">
<div class="vis-item-overflow">
<div class="vis-item-content" style="transform: translateX(0px);">
<img src="image_src">
</div>
<div class="vis-item-visible-frame">
</div>
</div>
</div>
You can update the content to the full HTML you would like, including an image and text, then store this in the DataSet. The vis.js example named 'Custom Styling' here uses this approach.
Alternatively you could add custom data to the items in the DataSet, then use the template feature described in the documentation here to construct the HTML. This is the approach I would use.
An example of a template is incorporated into the post below and also at https://jsfiddle.net/xm95u40f/. The example adds a property named
imageColor
to each item in the DataSet, this is used in combination with the text from the content to display the item. You could store and use yourentity-uuid
value in a similar way.