dhtmlxGantt arbeitet mit Daten in mehreren Formaten:
Zusätzlich ist es möglich, benutzerdefinierte Eigenschaften in Gantt-Daten einzuschließen.
Hier ist eine Beispielstruktur in JSON für Aufgaben und Verknüpfungen:
{
"tasks":[
{"id":"1", "text":"Projekt #2", "start_date":"01-04-2020", "duration":18,
"progress":0.4, "open": true},
{"id":"2", "text":"Aufgabe #1", "start_date":"02-04-2020", "duration":8,
"progress":0.6, "parent":"1"},
{"id":"3", "text":"Aufgabe #2", "start_date":"11-04-2020", "duration":8,
"progress":0.6, "parent":"1"}
],
"links":[
{"id":"1", "source":"1", "target":"2", "type":"1"},
{"id":"2", "source":"2", "target":"3", "type":"0"},
{"id":"3", "source":"3", "target":"4", "type":"0"},
{"id":"4", "source":"2", "target":"5", "type":"2"}
]
}
Hier ist ein Beispiel, das Aufgaben, Ressourcen und Ressourcenzuweisungen umfasst:
{
tasks: [
...,
{
id: 5,
text: "Bürointerieur",
type: "task",
start_date: "03-04-2024 00:00",
duration: 7,
parent: "2",
owner: [
{
resource_id: "6",
value: 3,
start_date: "03-04-2024 00:00",
end_date: "05-04-2024 00:00",
}
]
},
...
],
links: [],
resources: [
{id: 6, text: "John", unit: "hours/day" },
{id: 7, text: "Mike", unit: "hours/day" },
{id: 8, text: "Anna", unit: "hours/day" },
{id: 9, text: "Bill", unit: "hours/day" },
{id: 10, text: "Floe", unit: "hours/day" }
]
}
Falls erforderlich, können Ressourcenzuweisungen separat von den Aufgaben übergeben werden:
{
tasks: [
...,
{
id: 5,
text: "Bürointerieur",
type: "task",
start_date: "03-04-2024 00:00",
duration: 7,
parent: "2",
priority: 1
},
...
],
links: [],
assignments: [
{
id: 1, task_id: 5, resource_id: 6, value: 3,
start_date: "03-04-2024 00:00",
end_date: "05-04-2024 00:00"
}
],
resources: [
{id: 6, text: "John", unit: "hours/day" },
{id: 7, text: "Mike", unit: "hours/day" },
{id: 8, text: "Anna", unit: "hours/day" },
{id: 9, text: "Bill", unit: "hours/day" },
{id: 10, text: "Floe", unit: "hours/day" }
]
}
Hier ist eine XML-Darstellung für Aufgaben und Verknüpfungen:
<data>
<task id='1' parent='' start_date='01-04-2020' duration='18' open='true'
progress='0.4' end_date='19-04-2020'>
<![CDATA[Projekt #2]]>
</task>
<task id='2' parent='1' start_date='02-04-2020' duration='8' progress='0.6'
end_date='10-04-2020'>
<![CDATA[Aufgabe #1]]>
</task>
<task id='3' parent='1' start_date='11-04-2020' duration='8' progress='0.6'
end_date='19-04-2020'>
<![CDATA[Aufgabe #2]]>
</task>
<coll_options for='links'>
<item id='1' source='1' target='2' type='1' />
<item id='2' source='2' target='3' type='0' />
<item id='3' source='3' target='4' type='0' />
<item id='4' source='2' target='5' type='2' />
</coll_options>
</data>
So können Sie benutzerdefinierte Eigenschaften wie priority und holder in die Daten aufnehmen:
{
"tasks":[
{"id":"1", "text":"Projekt #2", "start_date":"01-04-2020", "duration":18,
"progress":0.4, "open": true, "holder":"Mike", "priority":"High"},
{"id":"2", "text":"Aufgabe #1", "start_date":"02-04-2020", "duration":8,
"progress":0.6, "parent":1, "holder":"John", "priority":"Medium"},
{"id":"3", "text":"Aufgabe #2", "start_date":"11-04-2020", "duration":8,
"progress":0.6, "parent":1, "holder":"Alex", "priority":"Low"}
],
"links":[
{"id":"1", "source":"1", "target":"2", "type":"1"},
{"id":"2", "source":"2", "target":"3", "type":"0"},
{"id":"3", "source":"3", "target":"4", "type":"0"},
{"id":"4", "source":"2", "target":"5", "type":"2"}
]
}
<data>
<task id='1' parent='' start_date='01-04-2020' duration='18' open='true'
progress='0.4' end_date='19-04-2020''>
<holder><![CDATA[Mike]]></holder>
<priority><![CDATA[High]]></priority>
<![CDATA[Projekt #2]]>
</task>
<task id='2' parent='1' start_date='02-04-2020' duration='8' progress='0.6'
end_date='10-04-2020'>
<holder><![CDATA[John]]></holder>
<priority><![CDATA[Medium]]></priority>
<![CDATA[Aufgabe #1]]>
</task>
<task id='3' parent='1' start_date='11-04-2020' duration='8' progress='0.6'
end_date='19-04-2020'>
<holder><![CDATA[Alex]]></holder>
<priority><![CDATA[Low]]></priority>
<![CDATA[Aufgabe #2]]>
</task>
<coll_options for='links'>
<item id='1' source='1' target='2' type='1' />
<item id='2' source='2' target='3' type='0' />
<item id='3' source='3' target='4' type='0' />
<item id='4' source='2' target='5' type='2' />
</coll_options>
</data>
JSON kann auch zusätzliche Arrays in der "collections"-Eigenschaft des data-Objekts enthalten:
{
"tasks":[
{"id":"1", "text":"Projekt #2", "start_date":"01-04-2020", "duration":18,
"progress":0.4, "open": true},
{"id":"2", "text":"Aufgabe #1", "start_date":"02-04-2020", "duration":8,
"progress":0.6, "parent":"1"},
{"id":"3", "text":"Aufgabe #2", "start_date":"11-04-2020", "duration":8,
"progress":0.6, "parent":"1"}
],
"links":[
{"id":"1", "source":"1", "target":"2", "type":"1"},
{"id":"2", "source":"2", "target":"3", "type":"0"},
{"id":"3", "source":"3", "target":"4", "type":"0"},
{"id":"4", "source":"2", "target":"5", "type":"2"}
],
"collections": {
"sections":[
{"value":"1","label":"Einfach"},
{"value":"2","label":"Komplex"},
{"value":"3","label":"Unbekannt"}
]
}
}
Sie können die Methode gantt.serverList verwenden, um auf diese Sammlungen zuzugreifen.
Hier ist ein Beispiel für das ältere XML-Format, das in dhtmlxGantt-Versionen vor 2.0 verwendet wurde:
<?xml version="1.0" encoding="UTF-8"?>
<projects>
<project id="1" name="projekt1" startdate="2006,12,14">
<task id="1">
<name>projekt1 aufgabe1</name>
<est>2006,12,14</est>
<duration>120</duration>
<percentcompleted>60</percentcompleted>
<predecessortasks></predecessortasks>
<childtasks>
<task id="2">
<name>projekt1 aufgabe2</name>
<est>2006,12,14</est>
<duration>100</duration>
<percentcompleted>20</percentcompleted>
<predecessortasks></predecessortasks>
<childtasks></childtasks>
</task>
<task id="6">
<name>projekt1 aufgabe6</name>
<est>2006,12,15</est>
<duration>90</duration>
<percentcompleted>10</percentcompleted>
<predecessortasks>2</predecessortasks>
<childtasks></childtasks>
</task>
</childtasks>
</task>
</project>
<project id="2" name="projekt2" startdate="2006,12,20">
<task id="12">
<name>projekt2 aufgabe12</name>
<est>2006,12,20</est>
<duration>140</duration>
<percentcompleted>60</percentcompleted>
<predecessortasks></predecessortasks>
<childtasks>
<task id="14">
<name>projekt2 aufgabe14</name>
<est>2006,12,20</est>
<duration>100</duration>
<percentcompleted>20</percentcompleted>
<predecessortasks></predecessortasks>
<childtasks></childtasks>
</task>
</childtasks>
</task>
</project>
</projects>
Zurück nach oben