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

How can we show start time and stop time in task gantt? #7

Closed
ANovokmet opened this issue Oct 23, 2020 · 3 comments
Closed

How can we show start time and stop time in task gantt? #7

ANovokmet opened this issue Oct 23, 2020 · 3 comments

Comments

@ANovokmet
Copy link
Owner

How can we show start time and stop time in task gantt?

Originally posted by @mstsargin in #6 (comment)

@ANovokmet
Copy link
Owner Author

Tasks contain moment which can be formatted and used in labels as you wish.
You can define taskContent for each task like this:

const options = {
    taskContent: (task) => `${task.label} ${task.from.format('HH:mm')}`
}

or you can update the label in the change event (happens before the actual change in the Gantt store)

gantt.api.tasks.on.change(([data]) => {
    const task = data.task.model;
    // be sure to add the "name" property
    task.label = `${task.name} ${task.from.format('HH:mm')}`;
});

ANovokmet added a commit that referenced this issue Oct 23, 2020
@kesyous
Copy link

kesyous commented Oct 23, 2020

Very thanks,
Can we move the conflicting others forward?

@ANovokmet
Copy link
Owner Author

Very thanks,
Can we move the conflicting others forward?

I suggest you find the conflicting tasks in the source collection, move their from and to and use gantt.$set({tasks: updatedTasks}).

Gantt exposes a function updateTask(task), that upserts a single task, but something like upsertAll(tasks) would be nice too.

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