Skip to main content

form_blocks

Description

An object of the lightbox controls

form_blocks: { checkbox?: LightboxControl; constraint?: LightboxControl; duration?: LightboxControl; duration_optional?: LightboxControl; parent?: LightboxControl; radio?: LightboxControl; resources?: LightboxControl; select?: LightboxControl; template?: LightboxControl; textarea?: LightboxControl; time?: LightboxControl; time_optional?: LightboxControl; typeselect?: LightboxControl; [ControlName: string]: LightboxControl | undefined }

Example

gantt.form_blocks["date_local_editor"] = {
render: function (sns) {
return "<input className='custom_section' type='datetime-local' name='1'/>"
},
set_value: function (node, value, task) {
if (task.start_date) {
const dateValue = gantt.date.date_to_str("%Y-%m-%d")(value);
const timeValue = gantt.date.date_to_str("%H:%i")(value);
const dateLocalValue = dateValue + "T" + timeValue;
node.value = dateLocalValue;
}
},
get_value: function (node, task) {
task.start_date = new Date(node.value)
task.end_date = gantt.calculateEndDate(task)
return task.start_date;
},
focus: function (node) {
const a = node;
a.select();
a.focus();
}
};

Details

The object has the following types:

  • checkbox - (LightboxControl) - the Checkbox control
  • constraint - (LightboxControl) - the Constraint control
  • duration - (LightboxControl) - the Duration control
  • duration_optional - (LightboxControl) - the Duration control that allows changing the section visibility
  • parent - (LightboxControl) - the Parent control
  • radio - (LightboxControl) - the Radio button control
  • resources - (LightboxControl) - the Resources control
  • select - (LightboxControl) - the Select control
  • template - (LightboxControl) - the Template control
  • textarea - (LightboxControl) - the Textarea control
  • time - (LightboxControl) - the Time control
  • time_optional - (LightboxControl) - the Time control that allows changing the section visibility
  • typeselect - (LightboxControl) - the Typeselect control
  • [ControlName: string] - (LightboxControl | undefined) - a custom control