# What's new in Gantt v5.2.0

## Segmented tasks support

In this release Gantt adds support for _segmented tasks_. Each task can be split into segments which then can be
adjusted separately, moved or merged back.

On the data level splitting a task can be done with a task model
[splitToSegments](#Gantt/model/TaskModel#function-splitToSegments) method call:

```js
// split task1 into segments at 2022-07-27 with split duration of 1 day
await task1.splitToSegments(new Date(2022, 6, 27), 1, "day")

/* here rescheduling is done */
```

Task model has got a new [segments](#Gantt/model/TaskModel#field-segments) field (plus properties to access the
[first](#Gantt/model/TaskModel#property-lastSegment) and [last](#Gantt/model/TaskModel#property-lastSegment) segment)
which returns an array of [EventSegmentModel](#SchedulerPro/model/EventSegmentModel) class instances.

Each segment can be changed individually:

```js
// change last segment end date
task1.lastSegment.endDate = new Date(2022, 7, 4)

// wait till rescheduling is done
await task1.commitAsync()

/* here rescheduling is done */
```
Or with [setEndDate](#SchedulerPro/model/EventSegmentModel#function-setEndDate) method call:
```js
await task1.lastSegment.setEndDate(new Date(2022, 7, 4))

/* here rescheduling is done */
```

Bringing two segments close to each merges them.

On the UI level segments support is handled by the following new features:

- [EventSegments](#SchedulerPro/feature/EventSegments) - implements rendering and adds new "Split event" entry to the
  event context menu.
- [TaskSegmentResize](#Gantt/feature/TaskSegmentResize) - implement individual segments resizing with drag'n'drop.
- [TaskSegmentDrag](#Gantt/feature/TaskSegmentDrag) - implement individual segments moving with drag'n'drop.

<div class="external-example" data-file="Gantt/feature/TaskSegments.js"></div>

## New widget for switching views

The [ViewPresetCombo](#Scheduler/widget/ViewPresetCombo) is an easy-to-setup preset picker which can be added to the
Gantt's toolbar and provides a simple UI for switching between different "views". It's based on
[ViewPreset](#Scheduler/preset/ViewPreset) which is built-in to Gantt.

Try it out in the live demo here:

<div class="external-example" data-file="./data/Gantt/examples/widget/ViewPresetCombo.js"></div>

## Stretch tasks by enabling `fillTicks`

The `fillTicks` config from Scheduler was ported over to Gantt. Enable it to always render task bars as full ticks
(time cells, the bottom level of the time axis header). When for example having days as the bottom level, a 6-hour task
will be stretched to fill the entire width of the tick, while a 25-hour task will fill two ticks.

<div class="external-example" data-file="Gantt/guides/whats-new/5.2.0/FillTicks.js"></div>

## Task non-working time

Gantt has a new feature `TaskNonWorkingTime`, which highlights the non-working time of the tasks, meaning time intervals
when they can not be worked on. It supports two modes of visualizing the intervals, `'row'` mode displays the intervals
as ranges in the tasks row (very similar to `ResourceNonWorkingTime` in Scheduler Pro) and `'bar'` mode displays them
as shaded regions of the task bar. Try it out in the live demos below, or the new `calendars` demo.

Row mode:

<div class="external-example" data-file="Gantt/feature/TaskNonWorkingTime.js"></div>

Bar mode:

<div class="external-example" data-file="Gantt/feature/TaskNonWorkingTimeBar.js"></div>

The modes can also be combined by specifying `mode: 'both'`.

## Improved grouping

The `TreeGroup` feature was reworked to allow manipulating the tasks in the generated structure, applying the same
rules as in the original view. Previously all tasks were all flagged as `manuallyScheduled` when grouped, circumventing
the rules. The improved behaviour was made possible by grouping to a new store instead of manipulating the original task
store, and then pointing Gantt to that store as the source if tasks to display. The tasks in the new store are linked to
those in the original store, manipulations are applied to both.

## Improved PDF Export feature

Pdf Export feature now renders exported content directly and does not scroll the view anymore. This significantly
improves performance (by an order of magnitude) and robustness of the export process. You can enable old behavior by
setting `enableDirectRendering` config on the export feature to `false`. Old behavior is deprecated and will be removed
in the next major release. Please report issues that make you disable direct rendering.

## Ignoring resource calendars

A task normally performs work when both its [own calendar](#Gantt/model/TaskModel#field-calendar) and some
of the assigned resource calendars (if any resource is assigned to the task) allow that.

With this release task model has got a new
[ignoreResourceCalendar](#Gantt/model/TaskModel#field-ignoreResourceCalendar) boolean field allowing to toggle
that logic.
When the field is set to `true` the task will not take its assigned resource calendars into account  and will perform
according to its own calendar only.

On the UI level the field is represented as "Ignore resource calendar" checkbox on the "Advanced" tab of
the [task editor](#Gantt/feature/TaskEdit) and a [new Gantt column](#Gantt/column/IgnoreResourceCalendarColumn).

## Multi-filter widget

You can now create UI to define and manage a set of `CollectionFilter`s using the `GridFieldFilterPickerGroup`
widget. The widget is configured with a reference to a Gantt, and shows a set of filters that filter the Gantt's
store as they are modified. The widget supports a variety of filtering operators based on the filter's selected
data field type, including new date range operators.

The Gantt's `filter` feature can also be configured with `isMulti` to show the new multi-filter UI in the column
header popup.

<div class="external-example" data-file="Gantt/guides/whats-new/5.2.0/GridFieldFilterPickerGroup.js"></div>


<p class="last-modified">Last modified on 2023-10-26 8:19:02</p>