serverList(list_name, array)

Required library edition:

returns named list of options

  • name of a list
  • array of options, optional

If called only with the first parameter (list_name) then returns a list with that name (if present). It's possible to pass array as a second parameter and then list_name will be bond with that array.

// returns list of options with the name my_list
var array = scheduler.serverList("my_list"); 
...
// creates and returns specified list
var list = scheduler.serverList("options", [
	{key: 1, label: "John"},
	{key: 2, label: "Adam"},
	{key: 3, label: "Diane"}
]);

Such named lists are used in the updateCollection function, that's why if there is need to update collections, e.g. select options, list of units in timeline, treetimeline, units view it's a good idea to create them as a named list of options.

// with such declaration it would be possible to update options in the select element though the list named 'goods'
scheduler.config.lightbox.sections=[   
	{name:"description", height:130, map_to:"text", type:"textarea" , focus:true},
	{name:"items", height:23, type:"select", options:serverList("goods", goods_array) , map_to:"section_id" }, 
	{name:"time", height:72, type:"time", map_to:"auto"}
]; 
...
// same here with the "units" list
scheduler.createUnitsView({
	name:"unit",
	property:"section_id",
	list:scheduler.serverList("units", sections),
	size:20,
	step:1
});