No default values for tasks


#1

Hi,
my isue-
I have some task which has only start_date.
for ex-

  1. Task A - start_date = “4-12-2018”, end_date = '", duration= 0
    Now we want in gantt tasklist this task should show only start date and end_date and duration columns should be empty.


    please refer screenshot.

  2. if task is unscheduled or we it does not have its own start_date. end_date, duration. These 3 fields should be empty , but custom columns should have values filled.


#2

Hello Sweeti,
If a task doesn’t have start_date and duration/end_date parameters, it takes missing parameters from other tasks. So, you won’t see “” in the end_date column in the grid, and you won’t be able to move or resize the task.
If you try to unschedule such a task, it will still have start_date, end_date and duration parameters, but by default, they won’t be displayed in the grid. So it won’t be possible to know which task didn’t have that parameter before the parse unless its name was different or unless you save it into another property of the task:
http://snippet.dhtmlx.com/9b64a3663

The second question was answered in another topic:


#3

You can use the columns property to implement custom logic for every possible column.

The example given is:

gantt.config.columns =  [
    {name:"text",       label:"Task name",  tree:true, width:'*' },
    {name:"start_date", label:"Start time", align: "center" },
    {name:"staff",      label:"Holder(s)", template:function(obj){
                                return obj.holder+"("+obj.progress+")"} }
];

so in your code you would propably replace staff with plannedstartdate and have a template function somewhere along the lines of:

 {name:"plannedstartdate",   template:function(obj){
    if(obj.start_date) {
       return "";
    } else {
       return obj.plannedstartdate;
   }
} }

#4

Hi,

Thanks for the solution, but this issue is not working. I want that if I don’t fill the end date and duration it should be seen as empty. End date should not be one day more than Start date. Also, it should not be as a mile stone.


#5

Hello Sweeti,
It is not possible to have only “start_date” parameter. If there are start_date and duration or end_date and duration, Gantt will calculate the missing parameter next time you update the task.
It will only work if there is no both start_date and end_date:
http://snippet.dhtmlx.com/412092d5d
If you still want that, you need to use different names for start_date and end_date, for example: starting_date and ending_date. Here is the snippet, demonstrating how it might work:
http://snippet.dhtmlx.com/26e7b3ab5