Event not display in timeline view

I have a scheluder with timeline view : [code]

Scheduler
<style type="text/css" media="screen">
	html, body {
		margin: 0;
		padding: 0;
		height: 100%;
		overflow: hidden;
	}
</style>

<script type="text/javascript" charset="utf-8">
	function init() {
		scheduler.locale.labels.timeline_tab = "Timeline";
		scheduler.locale.labels.section_room = "Room";
		scheduler.locale.labels.section_hoso = "Hồ sơ";
		scheduler.config.details_on_create = true;
		scheduler.config.details_on_dblclick = true;
		
		scheduler.config.xml_date = "%Y-%m-%d %H:%i";
		dhtmlXTooltip.config.className = 'dhtmlXTooltip tooltip';
		dhtmlXTooltip.config.timeout_to_display = 50;
		scheduler.templates.tooltip_text = function(start,end,event) {
			var i = event.hoso_id;
			var label = scheduler.getLabel("hoso_id", i);
			return label;
		}

		scheduler.templates.event_bar_text=function(start,end,event){
			var i = event.hoso_id;
			var label = scheduler.getLabel("hoso_id", i);
			return label;
		}
		
		/*scheduler.filter_timeline = function(ev_id, event){
			if(event.hoso_id < 4)
				return false; // event will be filtered (not rendered)
				//or
				return true; // event will be rendered
		}*/
		
		//===============
		//Configuration
		//===============
		
		var rooms = [
			{key: "P01", label: "Phòng 1"},
			{key: "P02", label: "Phòng 2"},
			{key: "P03", label: "Phòng 3"},
			{key: "P04", label: "Phòng 4"},
			{key: "P05", label: "Phòng 5"},
			{key: "P06", label: "Phòng 6"},
			{key: "P07", label: "Phòng 7"},
			{key: "P08", label: "Phòng 8"},
			{key: "P09", label: "Phòng 9"},
			{key: "P10", label: "Phòng 10"}
		];
		
		var hosos = [
			{key: 1, label: "Lập trình căn bản A - Nguyễn Văn A"},
			{key: 2, label: "Lập trình căn bản A - Trần Văn B"},
			{key: 3, label: "Lập trình hướng đối tượng C++ - Trần Văn D"},
			{key: 4, label: "Lập trình hướng đối tượng C++ - Nguyễn Văn C"},
			{key: 5, label: "Phát triển phần mềm mã nguồn mở - Ngô Bá Hùng"},
			{key: 6, label: "Lập trình cho các thiết bị di động - Đoàn Hòa Minh"}
		];

		var basicSort = function(a, b) {
			if (+a.start_date == +b.start_date) {
				return a.id > b.id ? 1 : -1;
			}
			return a.start_date > b.start_date ? 1 : -1;
		};
		var prioritySort = function(a, b) {
			// here we can define sorting logic, what event should be displayed at the top
			if (a.important && !b.important) {
				// display a before b
				return -1;
			} else {
				if (!a.important && b.important) {
					// display a after b
					return 1;
				} else {
					return basicSort(a, b);
				}
			}
		};

		// this function is not universal and should be changed depending on your timeline configuration
		var timeframeSort = function(a, b) {
			a_timeframe_start = scheduler.date.date_part(new Date(a.start_date));
			a_timeframe_end = scheduler.date.date_part(new Date(a.end_date));
			if (+a.end_date != +a_timeframe_end) {
				a_timeframe_end = scheduler.date.add(a_timeframe_end, 1, "day");
			}

			b_timeframe_start = scheduler.date.date_part(new Date(b.start_date));

			if (a_timeframe_start < b.end_date && a_timeframe_end > b.start_date && +a_timeframe_start == +b_timeframe_start) {
				return prioritySort(a, b);
			} else {
				return (a_timeframe_start < b_timeframe_start) ? -1 : 1;
			}
		};

		
		
		scheduler.createTimelineView({
			name: "timeline",
			x_unit: "day",
			x_date: "%d %F %Y",
			x_step: 1,
			x_size: 7,
			x_start: 1,
			x_length: 7,
			y_unit: rooms,
			y_property: "room_id",
			render: "bar",
			round_position: true,
			sort: timeframeSort
		});
		// Working week
		scheduler.date.timeline_start = scheduler.date.week_start;
		scheduler.date.add_timeline = function(date, step, something) {
			return scheduler.date.add(date, step * 7, "day");
		};
		
		

		//===============
		//Data loading
		//===============
		scheduler.config.lightbox.sections = [
			{ name: "hoso", height: 23, type: "select", options: hosos, map_to: "hoso_id" },
			//{ name: "description", height: 50, map_to: "text", type: "textarea", focus: true },
			{ name: "room", height: 23, type: "select", options: rooms, map_to: "room_id" },
			{ name: "time", height: 72, type: "time", map_to: "auto"}
		];

		scheduler.init('scheduler_here', new Date(), "timeline");
		scheduler.load("http://localhost/QLPTH/index.php/scheduler/data");

		var dp = new dataProcessor("http://localhost/QLPTH/index.php/scheduler/data");
		dp.action_param ="dhx_editor_status";

		dp.init(scheduler);
		/*scheduler.parse([
			{ start_date: "2013-03-06 10:00", end_date: "2013-03-06 12:10", hoso_id: 1, room_id: "P01" },
			{ start_date: "2013-03-06 10:00", end_date: "2013-03-06 16:00", hoso_id: 2, room_id: "P06" },
			{ start_date: "2013-03-06 10:00", end_date: "2013-03-06 14:00", hoso_id: 3, room_id: "P07" },
			{ start_date: "2013-03-06 16:05", end_date: "2013-03-06 17:00", hoso_id: 4, room_id: "P08"},

			{ start_date: "2013-03-08 12:05", end_date: "2013-03-08 17:45", hoso_id: 5, room_id: "P02"},
			{ start_date: "2013-03-08 05:05", end_date: "2013-03-08 07:45", hoso_id: 6, room_id: "P03"},
			{ start_date: "2013-03-30 16:30", end_date: "2013-03-30 18:00", hoso_id: 6, room_id: "P04"},
			{ start_date: "2013-03-30 18:30", end_date: "2013-03-30 20:00", hoso_id: 5, room_id: "P05"},

			{ start_date: "2013-03-07 10:00", end_date: "2013-03-07 12:10", hoso_id: 4, room_id: "P09" },
			{ start_date: "2013-03-07 10:00", end_date: "2013-03-07 16:00", hoso_id: 3, room_id: "P10"},
			{ start_date: "2013-03-07 10:00", end_date: "2013-03-07 14:00", hoso_id: 2, room_id: "P05" },
			{ start_date: "2013-03-07 16:05", end_date: "2013-03-07 17:00", hoso_id: 1, room_id: "P03"}
		], "json");*/
		
	}
</script>
 
 
[/code] and this is my scheluder.php [code]<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once("./dhtmlx/connector/scheduler_connector.php"); require_once("./dhtmlx/connector/db_phpci.php"); DataProcessor::$action_param ="dhx_editor_status";

class Scheduler extends CI_Controller {
public function index()
{
$this->load->view(‘scheduler’);// loads the view
}
public function data()
{
//data feed
$this->load->database();
//$this->load->model(“event_model”);
$connector = new SchedulerConnector($this->db, “PHPCI”);
$connector->configure(“chi_tiet_hs”, “id”, “start_date, end_date, room_id, hoso_id”);
//$connector->useModel($this->event_model);
$connector->render();
}
}[/code]
My event(chi_tiet_hs) can display in month, week and day view but in timeline view i can’t see it.
I use codeigniter framework.
Can anybody help me?






I found that my problem is the other of hoso_id and room_id :laughing:

I got a new problem. I can see event but its text is empty.


Try to load
localhost/QLPTH/index.php/scheduler/data
directly in browser and check generated JSON data, which values are set for room_id in event tag attributes ? Is it equal to one of keys in rooms collection ?

The problem in timiline view may be related to missed or invalid room_id values, without them scheduler will not be able to detect in which area event must be rendered.

I think your server side code need to be changed as

$connector->configure(“chi_tiet_hs”, “id”, “start_date, end_date, text, room_id, hoso_id”);

third field name in the list is the name of field from from which scheduler will take event text

the values return is valid and in my chi_tiet_hs table don’t have text column so i not need to add it to connector config
I recognize if I open an event’s lightbox and press save button, this event display correctly but when i refresh the page everything back to normal.

sorry men. the values return is wrong but if I add text to my connector config, the scheduler display nothing.


I got it! I add text column to my chi_tiet_hs and it work well. But I wonder is there any other way that’s not change my chi_tiet_hs table structure

If you are using connector only for data loading, you can use the next
Which will create fake field for “text” ( there is no need to create such field in DB )

$connector->configure(“chi_tiet_hs”, “id”, “start_date, end_date, 0(text), room_id, hoso_id”);

If you are using connector for saving as well - it still possible to handle it without extra fields in database, but will require some custom extra custom coding.

Thank