alexcode / vue2vis

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

Timeline methods #15

Closed satkunas closed 6 years ago

satkunas commented 6 years ago

We love this Vuejs extension, however there's no hints in the docs on how to access the Timeline methods seen here: http://visjs.org/docs/timeline/#Methods such as redraw().

How can Vuejs script get access to the Timeline objects' and its methods?

Menighin commented 6 years ago

You should give a ref atribute to your component and call the methods. For example:

<template>
     <timeline ref="timeline_ref"
         :items="items"
         :groups="groups"
         :options="options"> </timeline>
</template>

<script>
 //...
         this.$refs.timeline_ref.redraw();
 //...
</script>

For more on refs, checkout the Vue Documentation: https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements