# gantt-resource-view

> Gantt chart sample grouping tasks by resource with assignment and planning views.

**Framework:** javascript  **Component:** Gantt  **Variant:** resource-view

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/javascript/gantt-resource-view.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-gantt
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/gantt-resource-view/gantt.html

```html
<div class="control-section">
    <div class="content-wrapper">
        <div id="container">
        </div>
    </div>
</div>
```

### src/components/gantt-resource-view/gantt.ts

```typescript
import { Gantt, Selection, DayMarkers, Toolbar, Edit, Resize } from '@syncfusion/ej2-gantt';
import type { ClickEventArgs } from '@syncfusion/ej2-navigations';
import { resourcesData, resourceCollection } from '../datasource/gantt-data';
/**
 *  Resource view Gantt sample
 */

Gantt.Inject(Selection, DayMarkers, Toolbar, Edit, Resize);

export function initResourceViewGantt(): void {
    let gantt: Gantt = new Gantt(
        {
            dataSource: resourcesData,
            resources: resourceCollection,
            viewType: 'ResourceView',
            showOverAllocation: true,
            taskFields: {
                id: 'TaskID',
                name: 'TaskName',
                startDate: 'StartDate',
                endDate: 'EndDate',
                duration: 'Duration',
                progress: 'Progress',
                dependency: 'Predecessor',
                resourceInfo: 'resources',
                work: 'work',
                child: 'subtasks'
            },
            taskType:'FixedWork',
            resourceFields: {
                id: 'resourceId',
                name: 'resourceName',
                unit: 'resourceUnit',
                group: 'resourceGroup'
            },
            editSettings: {
                allowAdding: true,
                allowEditing: true,
                allowDeleting: true,
                allowTaskbarEditing: true,
                showDeleteConfirmDialog: true
            },
            columns: [
                { field: 'TaskID', visible: false },
                { field: 'TaskName', headerText: 'Name', width: 280 },
                { field: 'work', headerText: 'Work' },
                { field: 'Progress' },
                { field: 'resourceGroup', headerText: 'Group' },
                { field: 'StartDate' },
                { field: 'Duration' }
            ],
            toolbar: ['Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll',
            { text: 'Show/Hide Overallocation', tooltipText: 'Show/Hide Overallocation', id: 'showhidebar' }],
            toolbarClick: (args: ClickEventArgs) => {
                if (args.item.id === 'showhidebar') {
                    gantt.showOverAllocation = gantt.showOverAllocation ? false : true;
                }
            },
            labelSettings: {
                rightLabel: 'resources',
                taskLabel: 'Progress'
            },
            splitterSettings: {
                columnIndex: 3
            },
            allowResizing: true,
            allowSelection: true,
            highlightWeekends: true,
            treeColumnIndex: 1,
            height: '650px',
            rowHeight: 46,
            taskbarHeight: 25,
            projectStartDate: new Date('03/26/2025'),
            projectEndDate: new Date('05/18/2025')
        });
    gantt.appendTo('#container');
}

```
