I create my timeline like that 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
});
with rooms 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"}
];
now i want rooms get data from database, i tried to use datastore [code]var rooms = new dhtmlXDataStore();
rooms.data.scheme({
$init:function(obj){
obj.key = obj.value;// ‘name’ is the name of the column from the db
obj.label = obj.label;
}
});
var roomsdata = new dataProcessor("http://localhost/QLPTH/index.php/scheduler/rooms");
roomsdata.init(rooms);[/code] with the value of [url]http://localhost/QLPTH/index.php/scheduler/rooms[/url] is [ {"value":"P01","label":"P01"}, {"value":"P02","label":"P02"} ] but it not work.
What can i do to get data from database and set it for my rooms variable?