# Upgrade guide for Gantt v2.1.0

## Deadline field & column

TaskModel has a new field called `deadlineDate`. The field does not affect any calculations, it is purely for
visualization in the new `DeadlineColumn` and/or using the new `Indicators` feature described below.

```javascript
// A new field
taskRecord.deadlineDate = new Date(2020, 1, 21);

// And a new column
new Gantt({
  columns : [
    { type : 'deadlinedate' }
  ]
});
```

## Indicators

A new feature showing indicators in a task row. The following indicators are available out of the box:

* Early start/end dates (earlyDates)
* Late start/end dates (lateDates)
* Constraint date (constraintDate)
* Deadline date (deadlineDate)

By default all indicators are active when enabling the feature. Configure active indicators using the `items` config:

```javascript
new Gantt({
  features : {
    indicators : {
      items : {
        // Enable Early start/end dates
        earlyDates : true,
        // Disable Late start/end dates
        lateDates  : false
      }
    }
  }
});
```

It is also possible to add custom indicators using the same config. Supply it one or more functions that accepts a task
record and returns a TimeSpan (or its config) or null:

```javascript
new Gantt({
  features : {
    indicators : {
      items : {
        lateDates  : false,

        // Custom indicator only shown for tasks more than half done
        myCustomIndicator : taskRecord => taskRecord.percentDone > 50 ? {
           // Put it 2 days after the task
           startDate : DateHelper.add(taskRecord.endDate, 2, 'days'),
           // Name is displayed with the date in the tooltip
           name : 'My custom indicator',
           // Accepts an icon cls
           iconCls : 'b-fa b-fa-alien'
        } : null
      }
    }
  }
});
```

## Deprecations

The `tplData` parameter passed to `taskRenderer` was renamed to `renderData` to better reflect its purpose. If you are
using it in your code, please rename it.

**Old code:**

```javascript
new Gantt({
    taskRenderer({ taskRecord, tplData }) {
        tplData.cls.add('my-custom-cls');
    }
})
```

**New code:**

```javascript
new Gantt({
    taskRenderer({ taskRecord, renderData }) {
        renderData.cls.add('my-custom-cls');
    }
})
```


<p class="last-modified">Last modified on 2023-10-26 8:19:02</p>