Available only in PRO Edition
This functionality is available in the PRO Edition only.
A complex control used to assign multiple resources and their quantity to a task.
gantt.config.lightbox.sections = [
{name: "description", height: 38, map_to: "text", type: "textarea", focus: true},
{name:"owner",height:60, type:"resources", options:gantt.serverList("people"), map_to:"owner_id", default_value:8}, {name: "time", type: "duration", map_to: "auto"}
];
Related sample: Assign multiple resources
or
gantt.config.lightbox.sections = [
{ name:"description",height:38,map_to:"text",type:"textarea",focus:true },
{ name:"time",type:"duration",map_to:"auto" },
{ name:"rooms",type:"resources",map_to:"rooms", options:[ { key: 1, label: "room 1", unit: "hours" }, { key: 2, label: "room 2", unit: "hours" }, { key: 3, label: "room 3", unit: "hours" } ] } ];
gantt.locale.labels.section_rooms = "Rooms";
Related sample: Resources control
You can also create a custom control to assign multiple resources to a task.
To add the resources control to the lightbox, follow the steps below:
1. Add a section to the lightbox configuration:
var roomsMap = [
{ key: 1, label: "room 1", unit: "hours" },
{ key: 2, label: "room 2", unit: "hours" },
{ key: 3, label: "room 3", unit: "hours" }
];
gantt.config.lightbox.sections = [
{ name:"description",height:38,map_to:"text",type:"textarea",focus:true },
{ name:"time",type:"duration",map_to:"auto" },
{ name:"rooms",type:"resources",map_to:"rooms", options:roomsMap} ];
2. Set a label for the section:
gantt.locale.labels.section_resources = "Rooms";
Related sample: Resources control
The following properties are mostly important and commonly set for the resources control (see the full list here):
Generally, to set values for the resources control, use the options parameter:
gantt.config.lightbox.sections = [
{ name:"rooms",type:"resources",map_to:"rooms",
options:[
{ key: 1, label: "room 1", unit: "hours" },
{ key: 2, label: "room 2", unit: "hours" },
{ key: 3, label: "room 3", unit: "hours" }
]
}
];
Items in the options parameter have 3 mandatory properties:
To populate the control from the server, set the options option to the value returned by the serverList method:
gantt.config.lightbox.sections = [
{name: "description", height: 38, map_to: "text", type: "textarea", focus: true},
{name: "resources", type: "resources", map_to: "owner_id", default_value:8,
options: gantt.serverList("people")},
{name: "time", type: "duration", map_to: "auto"}
];
gantt.init("gantt_here");
gantt.load("/data");
Related sample: Assign multiple resources
Back to top