This is my first post so first of all:
Thank you for providing such a great library for free with such an active community!
Nevertheless I’m going crazy on a specific funtion.
What I’m trying to do is to publish a TreeTimeline view with tabs for ‘day’, ‘week’ and ‘month’. The data should be loaded dynamically through a java backend.
I managed to create the initial (‘day’) view by loading the backend data to the client, transform them into the TreeTimeline data-format shown in the guide and populate them to the scheduler (only the initial ‘day’ view).
My problem now is that the other views don’t show the whole content.
To clarify: The other views only show the hardcoded parents set in the ‘setTreeChilds()’-method but not the content set through my
sections = sched.serverList("sections2")
variable.
I’m quite new to javascript so any help would be highly appreciated!
What I’ve tried:
- Attach an onViewChangeEvent which triggers sched.updateView() -> no success
- Attach an onViewChangeEvent which triggers sched.clearAll() and sched.setCurrentView() -> no success
- Attach an onViewChangeEvent which triggers sched.updateCollection(“sections2”, sched.serverList(“sections2”)) -> no success
My init code:
[code]function initSched() {
var sections = scheduler.serverList(“sections2”);
var markedTimes = scheduler.serverList(“markedTimes”);
var permission = scheduler.serverList(“permission”);
// load config
...
// load Templates
...
// define Lightbox Template
...
// init events
...
// create Timeline (day)
scheduler.createTimelineView({
name: "timeline_D",
x_unit: "minute",
x_date: "%H:%i",
x_step: 30,
x_size: 24,
x_start: 16,
x_length: 48,
y_property: "section_id",
y_unit:setTreeChilds(sections),
render:"tree",
section_autoheight: false,
dy: 30
});
// (week)
scheduler.createTimelineView({
name: "timeline_W",
x_unit: "day",
x_date: "%d %M",
x_step: 1,
x_size: 7,
y_property: "section_id",
y_unit: setTreeChilds(sections),
render:"tree",
section_autoheight: false,
dy: 30
});
// (month)
scheduler.createTimelineView({
name: "timeline_M",
x_unit: "month",
x_date: "%M",
x_step: 1,
x_size: 1,
y_property: "section_id",
y_unit: setTreeChilds(sections),
render:"tree",
section_autoheight: false,
dy: 30
});
//===============
//Initialisation
//===============
scheduler.init('scheduler_div',null,'timeline_D');
scheduler.setLoadMode("month"); // lazy loading
scheduler.load("resource.do", function() {
//=== user rights ===
var user_key = permission[0].label;
var right = permission[1].label;
initPermission(user_key, right);
//=== create sections (y-achsis)
sections = setTreeChilds(sections); // create TreeTimeline sections
//=== blocked times
for(var i = 0; i < markedTimes.length; i++) {
var marked = markedTimes[i];
if(marked.id == 0) {
createGlobalBlock(marked);
}
else {
createSpecificBlock(marked);
}
}
scheduler.updateView(); // for addMarkedTS
});
// Dataprocessor (CRUD)
var dp = new dataProcessor("resource.do");
dp.defineAction("updated",function(node) {
...
});
dp.init(scheduler);
// console.log(window); //XXX DEBUG
}
[/code]
My setTreeChilds() Method:
[code]function setTreeChilds(sections) {
// init Parent-Objekte
var admin = {key:“admin”, label:“Administration”, open:false, children:[]};
var daten = {key:“daten”, label:“Datenteam”, open:true, children:[]};
var tech = {key:“tech”, label:“Technik”, open:false, children:[]};
var phrasen = {key:“phrasen”, label:“Phrasenteam”, open:false, children:[]};
var recherche = {key:“recherche”, label:“Recherche”, open:false, children:[]};
// iterate through backend data
for(var i = 0; i < sections.length; i++) {
var sec = sections[i];
if(sec.branch == "A") {
scheduler.addSection({key:sec.key+'', label:sec.label}, "admin");
}
else if(sec.branch == "D") {
scheduler.addSection({key:sec.key+'', label:sec.label}, "daten");
}
else if(sec.branch == "I") {
scheduler.addSection({key:sec.key+'', label:sec.label}, "tech");
}
else if(sec.branch == "P") {
scheduler.addSection({key:sec.key+'', label:sec.label}, "phrasen");
}
else if(sec.branch == "R") {
scheduler.addSection({key:sec.key+'', label:sec.label}, "recherche");
}
}
// combine parents in array
var treeSections = [admin, daten, tech, phrasen, recherche];
return treeSections;
}[/code]
What am I doing wrong? How can I populate the data in the other views?
Thanks in advance!
Cheers Simon