Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Update items or remove #4298

@nasir-awan

Description

@nasir-awan

I am using visjs and react-visjs-timeline in our reactjs application. I want to catch onMove, OnRemove etc event and call any other method within component to update items in state or redux store. When I try to do it, it throws an error Uncaught TypeError: .... is not a function

It seems like in onMove, onRemove ... other methods could not be reached within a component.

The items are updated in the timeline, but state items and group are not being updated. Looks like only one way data-binding .... If I change any item in the state, then it updates timeline.

Packages used
react-visjs-timeline: 1.5.0
vis version: 4.12.0

Code sample
`class TimelineExample extends React.Component {

onMoveItem = ()=>{
console.log('Im moving');
}

onRemoveItem = () => {
console.log('Im removing');
}

render() {
const options = {
height: 350, // px
editable: {
add: true,
remove: true,
updateTime: true
},
itemsAlwaysDraggable: true,
onMove: function (item, callback) {
onMoveItem(); // Error here
},
onRemove: function (item, callback) {
onRemoveItem(); // Error here
},
};

let items = new vis.DataSet([{
  id: 1,
  content: 'First event',
  start: '2014-08-01'
}, {
  id: 2,
  content: 'Second',
  start: '2014-08-08'
}]);

<Timeline
  options = {this.options}
  items={this.items}
/>   

}
}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions