@@ -61,7 +61,7 @@ In this case planning of tasks is implemented from the start date or from the da
6161The start date of the project can be optionally set by the ** gantt.config.project_start** config:
6262
6363~~~ js
64- gantt .config .project_start = new Date (2019 , 2 , 1 );
64+ gantt .config .project_start = new Date (2025 , 2 , 1 );
6565~~~
6666
6767{{sample 02_extensions/19_constraints_scheduling.html}}
@@ -73,7 +73,7 @@ via the **gantt.config.project_end** configuration option:
7373
7474~~~ js
7575gantt .config .schedule_from_end = true ;
76- gantt .config .project_end = new Date (2019 , 4 , 1 );
76+ gantt .config .project_end = new Date (2025 , 4 , 1 );
7777~~~
7878
7979In this case tasks are planned as late as possible. The last task should end on the end date of the project.
@@ -94,9 +94,9 @@ You can specify constraints for a task via the [**Constraint** control](desktop/
9494
9595~~~ js
9696gantt .config .lightbox .sections = [
97- { name: " description" , height: 38 , map_to: " text" , type: " textarea" , focus: true },
98- { name: " constraint" , type: " constraint" }, /* !*/
99- { name: " time" , type: " duration" , map_to: " auto" }
97+ { name: " description" , height: 38 , map_to: " text" , type: " textarea" , focus: true },
98+ { name: " constraint" , type: " constraint" }, /* !*/
99+ { name: " time" , type: " duration" , map_to: " auto" }
100100];
101101~~~
102102
@@ -119,22 +119,22 @@ const constraintTypeEditor = {
119119};
120120
121121const constraintDateEditor = {
122- type: " date" ,
123- map_to: " constraint_date" ,
124- min: new Date (2019 , 0 , 1 ),
125- max: new Date (2020 , 0 , 1 )
122+ type: " date" ,
123+ map_to: " constraint_date" ,
124+ min: new Date (2025 , 0 , 1 ),
125+ max: new Date (2026 , 0 , 1 )
126126};
127127
128128gantt .config .columns = [
129- { // previous column},
129+ { /* previous column */ },
130130 {
131- name: " constraint_type" , align: " center" , width: 100 , template : function ( task ){
132- return gantt .locale .labels [gantt .getConstraintType (task)];
133- }, resize: true , editor: constraintTypeEditor
131+ name: " constraint_type" , align: " center" , width: 100 ,
132+ template : task => gantt .locale .labels [gantt .getConstraintType (task)],
133+ resize: true , editor: constraintTypeEditor
134134 },
135135 {
136- name: " constraint_date" , align: " center" , width: 120 , template : function (task ) {
137- // template logic
136+ name: " constraint_date" , align: " center" , width: 120 , template : (task ) => {
137+ // template logic
138138 },
139139 resize: true , editor: constraintDateEditor
140140 },
@@ -207,18 +207,15 @@ Disabling auto scheduling for specific tasks
207207To disable auto scheduling for a particular task and make it manually scheduled, set the ** auto_scheduling** property of the task object to * false* :
208208
209209~~~ js
210- var task = gantt .getTask (id);
210+ const task = gantt .getTask (id);
211211task .auto_scheduling = false ;
212212~~~
213213
214214You can also prevent auto scheduling of a specific task using the api/gantt_onbeforetaskautoschedule_event.md handler:
215215
216216~~~ js
217- gantt .attachEvent (" onBeforeTaskAutoSchedule" ,function (task , start , link , predecessor ){
218- if (task .completed ) {
219- return false ;
220- }
221- return true ;
217+ gantt .attachEvent (" onBeforeTaskAutoSchedule" , (task , start , link , predecessor ) => {
218+ return ! task .completed ;
222219});
223220~~~
224221
@@ -308,7 +305,7 @@ gantt.autoSchedule(taskId);
308305In case you need to check whether the task is unscheduled, use the api/gantt_isunscheduledtask.md method with the task object as an argument:
309306
310307~~~ js
311- var isUnscheduled = gantt.isUnscheduledTask(task);
308+ const isUnscheduled = gantt .isUnscheduledTask (task);
312309~~~
313310
314311###Search for circular references
@@ -324,7 +321,7 @@ gantt.findCycles();
324321If you need to check whether the link is circular, you can apply the api/gantt_iscircularlink.md method:
325322
326323~~~ js
327- var isCircular = gantt.isCircularLink(link);
324+ const isCircular = gantt .isCircularLink (link);
328325~~~
329326
330327###Getting connected tasks and links
@@ -350,35 +347,35 @@ The list of available events is given below:
350347
351348~~~ js
352349// before auto scheduling starts
353- gantt.attachEvent("onBeforeAutoSchedule",function (taskId){
354- // any custom logic here
355- return true;
350+ gantt .attachEvent (" onBeforeAutoSchedule" , (taskId ) => {
351+ // any custom logic here
352+ return true ;
356353});
357354
358355// after auto scheduling finishes
359- gantt.attachEvent("onAfterAutoSchedule",function (taskId, updatedTasks){
360- // any custom logic here
356+ gantt .attachEvent (" onAfterAutoSchedule" , (taskId , updatedTasks ) => {
357+ // any custom logic here
361358});
362359
363360// before a particular task is rescheduled
364- gantt.attachEvent("onBeforeTaskAutoSchedule",function (task,start,link,predecessor){
365- // any custom logic here
366- return true;
361+ gantt .attachEvent (" onBeforeTaskAutoSchedule" , (task , start , link , predecessor ) => {
362+ // any custom logic here
363+ return true ;
367364});
368365
369366// after a particular task is rescheduled
370- gantt.attachEvent("onAfterTaskAutoSchedule",function (task,start,link,predecessor){
371- // any custom logic here
367+ gantt .attachEvent (" onAfterTaskAutoSchedule" , (task , start , link , predecessor ) => {
368+ // any custom logic here
372369});
373370
374371// if the circular reference has been detected and auto scheduling is not possible
375- gantt.attachEvent("onCircularLinkError",function (link, group){
376- // any custom logic here
372+ gantt .attachEvent (" onCircularLinkError" , (link , group ) => {
373+ // any custom logic here
377374});
378375
379376// if circular links were found during auto scheduling
380- gantt.attachEvent("onAutoScheduleCircularLink",function (groups){
381- // any custom logic here
377+ gantt .attachEvent (" onAutoScheduleCircularLink" , (groups ) => {
378+ // any custom logic here
382379});
383380~~~
384381
0 commit comments