Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groups does not display if originally empty #54

Closed
justindra opened this issue Dec 20, 2019 · 1 comment
Closed

Groups does not display if originally empty #54

justindra opened this issue Dec 20, 2019 · 1 comment

Comments

@justindra
Copy link

If we place an array of groups that is originally empty on mount/create, and then update the groups prop with a list of groups, the timeline is not updated to display those groups.

<template>
  <div class="timeline">
    <Timeline
      ref="timeline"
      :items="items"
      :groups="groups"
    ></Timeline>
 <button @click="addGroups()">Add Groups</button>
  </div>
</template>

<script lang="ts">
import { Vue, Component } from 'vue-property-decorator';
import { Timeline } from 'vue2vis';
import 'vue2vis/dist/vue2vis.css';
import getTimelineOptions from './timeline-options';
import { DataItem, DataGroup } from 'vis';

@Component({
  components: {
    Timeline
  }
})
export default class ScheduleTimeline extends Vue {
  items: DataItem[] = [];
  groups: DataGroup[] = [];

  addGroups() {
    this.groups = [
      { id: 1, content: 'Group 1' },
      { id: 2, content: 'Group 2' }
    ]
  }
}
</script>

The current workaround is to just add an Unassigned or empty group.

...
export default class ScheduleTimeline extends Vue {
  items: DataItem[] = [];
  groups: DataGroup[] = [ { id: 0, content: 'unassigned' } ];
}
@notchris
Copy link

And to also hide the necessary unassigned group:
{ id: 0, content: 'unassigned', visible: false }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants