javascript-ej1-demos/gantt/taskSchedulingMode.html

130 строки
6.2 KiB
HTML

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Essential JS 1 : Gantt</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<link href="../content/bootstrap.min.css" rel="stylesheet" />
<link href="../content/ejthemes/default-theme/ej.web.all.min.css" rel="stylesheet" />
<link href="../content/default.css" rel="stylesheet" />
<link href="../content/default-responsive.css" rel="stylesheet" />
<link href="../content/ejthemes/responsive-css/ej.responsive.css" rel="stylesheet" />
<!--[if lt IE 9]>
<script type="text/javascript" src="../scripts/jquery-1.11.3.min.js" ></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="../scripts/jquery-3.4.1.min.js" type="text/javascript"> </script>
<!--<![endif]-->
<script src="../scripts/jsrender.min.js"></script>
<script src="../scripts/ej.web.all.min.js" type="text/javascript"></script>
<script src="../scripts/properties.js" type="text/javascript"></script>
</head>
<body>
<div class="content-container-fluid">
<div class="row">
<div class="cols-sample-area">
<div id="GanttContainer" style="height:450px;width:100%;"></div>
</div>
</div>
</div>
<script type="text/javascript">
//DATA SOURCE DECLARATION OF GANTT CONTROL
var scheduleModeData = [
{
"TaskID": 1,
"TaskName": "Parent Task 1",
"StartDate": new Date("02/27/2017"),
"EndDate": new Date("03/03/2017"),
"Progress": "40",
"isManual" : true,
"Children": [
{ "TaskID": 2, "TaskName": "Child Task 1", "StartDate": new Date("02/27/2017"), "EndDate": new Date("03/03/2017"), "Progress": "40" },
{ "TaskID": 3, "TaskName": "Child Task 2", "StartDate": new Date("02/26/2017"), "EndDate": new Date("03/03/2017"), "Progress": "40","isManual": true },
{ "TaskID": 4, "TaskName": "Child Task 3", "StartDate": new Date("02/27/2017"), "EndDate": new Date("03/03/2017"), "Duration": 5, "Progress": "40", }
]
},
{
"TaskID": 5,
"TaskName": "Parent Task 2",
"StartDate": new Date("03/05/2017"),
"EndDate": new Date("03/09/2017"),
"Progress": "40",
"isManual": true,
"Children": [
{ "TaskID": 6, "TaskName": "Child Task 1", "StartDate": new Date("03/06/2017"), "EndDate": new Date("03/09/2017"), "Progress": "40" },
{ "TaskID": 7, "TaskName": "Child Task 2", "StartDate": new Date("03/06/2017"), "EndDate": new Date("03/09/2017"), "Progress": "40", },
{ "TaskID": 8, "TaskName": "Child Task 3", "StartDate": new Date("02/28/2017"), "EndDate": new Date("03/05/2017"), "Progress": "40","isManual":true },
{ "TaskID": 9, "TaskName": "Child Task 4", "StartDate": new Date("03/04/2017"), "EndDate": new Date("03/09/2017"), "Progress": "40","isManual":true }
]
},
{
"TaskID": 10,
"TaskName": "Parent Task 3",
"StartDate": new Date("03/13/2017"),
"EndDate": new Date("03/17/2017"),
"Progress": "40",
"Children": [
{ "TaskID": 11, "TaskName": "Child Task 1", "StartDate": new Date("03/13/2017"), "EndDate": new Date("03/17/2017"), "Progress": "40" },
{ "TaskID": 12, "TaskName": "Child Task 2", "StartDate": new Date("03/13/2017"), "EndDate": new Date("03/17/2017"), "Progress": "40", },
{ "TaskID": 13, "TaskName": "Child Task 3", "StartDate": new Date("03/13/2017"), "EndDate": new Date("03/17/2017"), "Progress": "40", },
{ "TaskID": 14, "TaskName": "Child Task 4", "StartDate": new Date("03/12/2017"), "EndDate": new Date("03/17/2017"), "Progress": "40","isManual":true },
{ "TaskID": 15, "TaskName": "Child Task 5", "StartDate": new Date("03/13/2017"), "EndDate": new Date("03/17/2017"), "Progress": "40", }
]
}
];
$(function () {
$("#GanttContainer").ejGantt({
dataSource: scheduleModeData,
allowSelection: true,
allowColumnResize: true,
taskIdMapping: "TaskID",
taskNameMapping: "TaskName",
scheduleStartDate: new Date("02/20/2017"),
scheduleEndDate: new Date("03/30/2017"),
startDateMapping: "StartDate",
endDateMapping: "EndDate",
progressMapping: "Progress",
childMapping: "Children",
treeColumnIndex: 0,
predecessorMapping: "predecessor",
taskSchedulingModeMapping: "isManual",
includeWeekend: false,
taskSchedulingMode: ej.Gantt.TaskSchedulingMode.Custom,
isResponsive: true,
splitterPosition: "20%",
rowHeight: window.theme == "material" ? 48 : window.theme == "office-365" ? 36 : 30,
toolbarSettings: {
showToolbar: true,
toolbarItems: [ej.Gantt.ToolbarItems.Add,
ej.Gantt.ToolbarItems.Edit,
ej.Gantt.ToolbarItems.Update,
ej.Gantt.ToolbarItems.Cancel,
]
},
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
editMode: "cellEditing"
},
load: load,
});
});
function load(args) {
var columns = this.getColumns();
for (var i = 1; i <= 5; i++)
columns[i].visible = false;
columns[0].width = window.theme == "material" ? 120 : 80;
}
</script>
</body>
</html>