Data collections allow you to load data statically, without making requests to server and without reloading the page.
You may need data collections in different situations:
In general, to create a data collection and populate some element with it, you should follow the steps below:
Here are code samples of data collections you may use in the situations stated above:
You can use data collections to load events to the scheduler
var items = new List(){
new { id = "1", text = "first event", start_date = "03.06.2011", end_date = "04.06.2011" },
new { id = "2", text = "second event", start_date = "05.06.2011", end_date = "06.06.2011" }
};
var data = new SchedulerAjaxData(items);
Note, to be correctly processed data items for the controls should have 4 properties:
See available variations of the format string here.
You can use a data collection to define select options of a dropdown list, e.g. 'select' control.
var select = new LightboxSelect("textColor", "Priority");
var items = new List(){
new { key = "gray", label = "Low" },
new { key = "blue", label = "Medium" },
new { key = "red", label = "High" }
};
select.AddOptions(items);
Note, to be correctly processed data items for the controls should have 2 properties:
Y-Axis items in the Timeline view can be specified by a data collection.
var timeline = new TimelineView("timeline_id", "room_id"); // initializes the view
sched.Views.Add(timeline); // adds the view to the scheduler
var rooms = new List(){
new { key = "1", label = "Room 1"},
new { key = "2", label = "Room 2"}
};
timeline.AddOptions(rooms);
Note, to be correctly processed data items for the controls should have 2 properties:
X-Axis items in the Units view can be specified by a data collection.
var unit = new UnitsView("unit1", "room_id"); // initializes the view
sched.Views.Add(unit); // adds the view to the scheduler
var rooms = new List(){
new { key = "1", label = "Room 1"},
new { key = "2", label = "Room 2"}
};
unit.AddOptions(rooms);
Note, to be correctly processed data items for the controls should have 2 properties: