Hi guys,
I am loading data to the timeline view. Basically I want to show staff on the Y-Axis that have shifts in the current timeline view. So if the time line is the next two weeks i need to show only the staff who have shifts in that period (e.g. this might only be 5 staff out of a total of 100).
on the server I find the staff in this way:
$staffQuery = “SELECT type_id as value, staff as label from v_schedule_tl WHERE start_date
> ‘$_GET[from]’ AND end_date
< ‘$_GET[to]’”;
$staffList = new OptionsConnector($connection);
$staffList->render_sql($staffQuery,“type_id”,“type_id(value),name(label)”);
$scheduler->set_options(“sections”, $staffList);
Which effectively selects the staff which work in the time period sent up in the server request (i have set scheduler.setLoadMode(“week”)
then i find the shifts they have worked using
$shiftQuery = “SELECT id, type_id,text, start_date, end_date FROM v_schedule_tl”;
$scheduler->render_sql($shiftQuery,“id”,“start_date,end_date,text,type_id”);
So this is all ok. But when I click on the left/right arrows on the timeline on scheduler it gets all out of synch, i.e. the from and to date shown on the timeline aren’t consistent with what the DHTMLX library sends up as the from/to dates in the server request. How can i configure the timeline to match the date span in the server request, particularly so that only staff who have a shift are shown in the Y-Axis.
Here is my scheduler config for info.
cheduler.locale.labels.timeline_tab =“Timeline”;
scheduler.locale.labels.section_custom="Section";
scheduler.config.details_on_create=true;
scheduler.config.details_on_dblclick=true;
scheduler.config.dblclick_create = false;
scheduler.config.drag_move = false;
scheduler.config.drag_resize= false;
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.config.show_loading = true;
scheduler.setLoadMode("week");
scheduler.createTimelineView({
name:"timeline",
x_unit:"day",//measuring unit of the X-Axis.
x_date:"%D %d %M", //date format of the X-Axis
x_step:1, //X-Axis step in 'x_unit's
x_size:21, //X-Axis length specified as the total number of 'x_step's
x_start:1, //X-Axis offset in 'x_unit's
// x_length:1, //number of 'x_step's that will be scrolled at a time
y_unit:scheduler.serverList("sections"),
y_property:"type_id", //mapped data property
render:"bar", //view mode
round_position:true,
section_autoheight:false,
dy:25,
second_scale:{
x_unit: "week", // the measuring unit of the axis (by default, 'minute')
x_date: "%W" //the date format of the axis ("July 01")
}
});
scheduler.init('scheduler_here', new Date(), "timeline");
scheduler.load("ccproc/utracserver.php?server_req=timelineLoad&req_type=api", "xml");
thanks!
Cyril