Browse Source

fix date range

pull/1/head
wahyu 1 year ago
parent
commit
7bf1731fb1
  1. 14
      edit-mode/function/ganttEvent.js

14
edit-mode/function/ganttEvent.js

@ -10,6 +10,7 @@ gantt.attachEvent("onAfterTaskAdd", function (id, item) {
gantt.updateTask(parentId);
}
}
updateRange();
});
gantt.attachEvent("onTaskRowClick", function (id, row) {
@ -40,7 +41,16 @@ gantt.ext.inlineEditors.attachEvent("onBeforeEditStart", function (state) {
}
return true
});
function updateRange(){
var range = gantt.getSubtaskDates();
var chart = gantt.getState();
if(range.start_date.valueOf() <= chart.min_date.valueOf() || range.end_date.valueOf() >= chart.max_date.valueOf()){
gantt.config.start_date = gantt.date.add(range.start_date, -1, "day");
gantt.config.end_date = gantt.date.add(range.end_date, 2, "day");
gantt.render();
}
}
gantt.attachEvent("onAfterTaskUpdate", updateRange);
gantt.attachEvent("onBeforeTaskUpdate", function (id, new_item) {
// format progress
let progress = new_item.progress;
@ -183,4 +193,4 @@ gantt.attachEvent("onGanttScroll", function (left, top){
},20)
}
}
});
});

Loading…
Cancel
Save