Hi,
For my current development I require the duration in seconds, which I’ve setup a custom scale for and also require to have both start date and end date in the lightbox section under the following format “%d %m %y %h:%i:%s”.
I’ve used the custom blocks functionality to setup the required section, but I am not able to get it save both start date and end date. I can get it to save either one of them and the other one is automatically synced to the min duration I’ve setup(1 sec).
I’ve used the following custom form blocks:
gantt.form_blocks[“date_start_editor”] = {
render: function (sns) {
return “
//"< TimePicker defaultValue = { moment(‘12:08:23’, ‘HH:mm:ss’) } value = ‘value’ /> "
//< div >
},
set_value: function (node, value, task) {
if (!task.unscheduled) {
var date_local_value = gantt.date.date_to_str("%Y-%m-%d")(value) + "T" + gantt.date.date_to_str("%H:%i")(value)
node.childNodes[0].value = date_local_value;
}
},
get_value: function (node, task) {
task.start_date = new Date(node.childNodes[0].value)
task.end_date = gantt.calculateEndDate(task.start_date, task.duration)
return task.start_date;
},
focus: function (node) {
var a = node.childNodes[0];
a.select();
a.focus();
}
};
gantt.form_blocks[“date_end_editor”] = {
render: function (snd) {
return “
//"< TimePicker defaultValue = { moment(‘12:08:23’, ‘HH:mm:ss’) } value = ‘value’ /> "
//< div >
},
set_value: function (node, value, task) {
if (!task.unscheduled) {
var date_local_value = gantt.date.date_to_str("%Y-%m-%d")(value) + "T" + gantt.date.date_to_str("%H:%i")(value)
node.childNodes[0].value = date_local_value;
}
},
get_value: function (node, task) {
task.end_date= new Date(node.childNodes[0].value)
return task.end_date;
},
focus: function (node) {
var a = node.childNodes[0];
a.select();
a.focus();
}
};
This is how I want the two fields to look. I’ve tried to use the built-in picker but there I could not find any proof that it supports timestamp edit on the range picker. Only way I managed to did it was using the duration type time picker but it’s not what I am looking for. I cannot add both start end date and duration using that.
On task drag I have no issues scheduling, it syncs automatically the the zoom I am currently in.
Any help would be highly appreciated!
Thanks!