I will start using frappe gannt.
Even though I move task bar, progress and date not worked in custom_popup_html!
like these below.
before moving
[![enter image description here][1]][1]
after moving [![enter image description here][2]][2]
Date doesn't be changed.
code relating the issue are described.
please help about this issue!!
thank you
'use strict'
function getView(view) {
gantt.change_view_mode(view);
}
let tasks = [
{
id: 'Task 1',
name: 'Redesign website',
start: '2022-1-28',
end: '2022-1-31',
progress: 20,
dependencies: ''
},
{
id: 'Task 2',
name: 'Redesign website',
start: '2022-2-2',
end: '2022-2-10',
progress: 20,
dependencies: 'Task 1'
},
{
id: 'Task 3',
name: 'Redesign website',
start: '2022-2-12',
end: '2022-2-20',
progress: 20,
dependencies: 'Task 2'
}
]
let gantt = new Gantt("#gantt", tasks, {
on_click: function (task) {
console.log(task);
},
on_date_change: function (task, start, end) {
console.log(task, start, end);
},
on_progress_change: function (task, progress) {
console.log(task, progress);
},
on_view_change: function (mode) {
console.log(mode);
},
custom_popup_html: function (task) {
return `
<div class="card" style="width: 10rem;">
<div class="card-body">
<h6>${task.name}</h6>
<p>Expected to finish by ${task.end}</p>
<p>${task.progress}% completed!</p>
</div>
</div>
`;
}
});
let btnContainer = document.getElementById("myButtonGrp");
let btns = btnContainer.getElementsByClassName("btn");
for (let i = 0; i < btns.length; i++) {
btns[i].addEventListener("click", () => {
let current = document.getElementsByClassName("active");
current[0].className = current[0].className.replace(" active", "");
this.className += " active";
});
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<!-- frappe gannt -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/frappe-gantt/0.5.0/frappe-gantt.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/frappe-gantt/0.5.0/frappe-gantt.min.js"></script>
<!-- stylesheet -->
<link rel="stylesheet" type="text/css" href='style.css'>
</head>
<body>
<div class="shadow p-3 m-5 bg-body rounded">
<h2 class="border-bottom mb-4">Gannt chart</h2>
<svg id="gantt"></svg>
<div id="myButtonGrp" class="mx-auto mt-3 btn-group" role="group">
<button onclick="gantt.change_view_mode('Day')" type="button" class="btn btn-sm btn-light">Day</button>
<button onclick="gantt.change_view_mode('Week')" type="button" class="btn btn-sm btn-light active">Week</button>
<button onclick="gantt.change_view_mode('Month')" type="button" class="btn btn-sm btn-light">Month</button>
</div>
</div>
<script src="script.js"></script>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8"
crossorigin="anonymous"></script>
</body>
</html>