How can I help you?
Resource View in React Gantt Chart Component
17 Mar 202624 minutes to read
The resource view in the React Gantt Chart component organizes tasks hierarchically by resource, displaying resources as parent nodes and their assigned tasks as child taskbars in a timeline. Enabled by setting viewType to ResourceView, this view visualizes workloads, such as multiple tasks per resource, with taskbars showing duration, progress, and dependencies. Unassigned tasks group under an Unassigned Task node. The queryTaskbarInfo event customizes taskbar styles, and overallocation indicators highlight scheduling conflicts. Taskbars include ARIA labels for accessibility, ensuring screen reader compatibility, and adapt to responsive designs, though narrow screens may truncate resource names. Parent tasks are not supported, and tasks require scheduling (start date and duration).
Configure resource view
Enable resource view by setting viewType to ResourceView and mapping resources via resources and resourceFields. Tasks are assigned using taskFields.resourceInfo.
The following example configures resource view:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
GanttComponent,
Inject,
Edit,
Selection,
Toolbar
} from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields = {
id: 'resourceId',
name: 'resourceName',
unit: 'Unit',
group: 'resourceGroup'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns = [
{ field: 'TaskID', visible: false },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar = ['Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll'];
const labelSettings = { rightLabel: 'resources' };
const splitterSettings = { columnIndex: 3 };
const projectStartDate = new Date('03/25/2019');
const projectEndDate = new Date('07/28/2019');
return (
<GanttComponent
height="430px"
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
labelSettings={labelSettings}
splitterSettings={splitterSettings}
toolbar={toolbar}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={projectStartDate}
projectEndDate={projectEndDate}
viewType="ResourceView"
>
<Inject services={[Toolbar, Edit, Selection]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
GanttComponent,
Inject,
Edit,
Selection,
Toolbar,
TaskFieldsModel,
ResourceFieldsModel,
EditSettingsModel,
SplitterSettingsModel,
LabelSettingsModel
} from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields: ResourceFieldsModel = {
id: 'resourceId',
name: 'resourceName',
unit: 'Unit',
group: 'resourceGroup'
};
const editSettings: EditSettingsModel = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns: Object[] = [
{ field: 'TaskID', visible: false },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar: string[] = ['Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll'];
const labelSettings: LabelSettingsModel = { rightLabel: 'resources' };
const splitterSettings: SplitterSettingsModel = { columnIndex: 3 };
const projectStartDate = new Date('03/25/2019');
const projectEndDate = new Date('07/28/2019');
return (
<GanttComponent
height="430px"
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
labelSettings={labelSettings}
splitterSettings={splitterSettings}
toolbar={toolbar}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={projectStartDate}
projectEndDate={projectEndDate}
viewType="ResourceView"
>
<Inject services={[Toolbar, Edit, Selection]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>This configuration groups tasks by resources, displaying them as child nodes.
Visualize resource overallocation
Overallocation occurs when tasks exceed a resource’s daily capacity, calculated from dayWorkingTime and resource unit in resourceFields.unit. Enable indicators with showOverAllocation set to true (default: false), highlighting affected date ranges with square brackets.
The following example toggles overallocation visibility:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
GanttComponent,
Inject,
Edit,
Selection,
Toolbar
} from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
let ganttObj = null;
const taskSettings = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields = {
id: 'resourceId',
name: 'resourceName',
unit: 'Unit',
group: 'resourceGroup'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns = [
{ field: 'TaskID', visible: false },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar = [
'Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll',
{ text: 'Show/Hide Overallocation', tooltipText: 'Show/Hide Overallocation', id: 'showhidebar' }
];
const labelSettings = {
rightLabel: 'resources',
taskLabel: 'Progress'
};
const splitterSettings = { columnIndex: 3 };
const projectStartDate = new Date('03/25/2019');
const projectEndDate = new Date('07/28/2019');
function toolbarClick(args) {
if (args.item.id === 'showhidebar') {
ganttObj.showOverAllocation = ganttObj.showOverAllocation ? false : true;
}
}
return (
<GanttComponent
id="ganttDefault"
ref={(g) => (ganttObj = g)}
height="430px"
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
splitterSettings={splitterSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={projectStartDate}
projectEndDate={projectEndDate}
viewType="ResourceView"
showOverAllocation={true}
toolbarClick={toolbarClick}
>
<Inject services={[Toolbar, Edit, Selection]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
GanttComponent,
Inject,
Edit,
Selection,
Toolbar,
TaskFieldsModel,
ResourceFieldsModel,
EditSettingsModel,
SplitterSettingsModel,
LabelSettingsModel
} from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
let ganttObj: any = null;
const taskSettings: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields: ResourceFieldsModel = {
id: 'resourceId',
name: 'resourceName',
unit: 'Unit',
group: 'resourceGroup'
};
const editSettings: EditSettingsModel = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns: Object[] = [
{ field: 'TaskID', visible: false },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar: (string | object)[] = [
'Add', 'Edit', 'Update', 'Delete', 'Cancel', 'ExpandAll', 'CollapseAll',
{ text: 'Show/Hide Overallocation', tooltipText: 'Show/Hide Overallocation', id: 'showhidebar' }
];
const labelSettings: LabelSettingsModel = {
rightLabel: 'resources',
taskLabel: 'Progress'
};
const splitterSettings: SplitterSettingsModel = { columnIndex: 3 };
const projectStartDate = new Date('03/25/2019');
const projectEndDate = new Date('07/28/2019');
function toolbarClick(args: any) {
if (args.item.id === 'showhidebar') {
ganttObj.showOverAllocation = ganttObj.showOverAllocation ? false : true;
}
}
return (
<GanttComponent
id="ganttDefault"
ref={(g) => (ganttObj = g)}
height="430px"
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
splitterSettings={splitterSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={projectStartDate}
projectEndDate={projectEndDate}
viewType="ResourceView"
showOverAllocation={true}
toolbarClick={toolbarClick}
>
<Inject services={[Toolbar, Edit, Selection]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>This configuration highlights scheduling conflicts for workload management.
Manage unassigned tasks
Tasks not assigned to any resource are termed unassigned tasks. These tasks are automatically grouped under a node labeled Unassigned Task and displayed at the bottom of the Gantt data collection. The system validates task assignments during load time based on the taskFields.resourceInfo mapping property in the data source.
When a resource is subsequently assigned to an unassigned task, the task automatically moves to become a child of the respective resource node.
Enable taskbar drag and drop
Enable taskbar drag-and-drop between resources with allowTaskbarDragAndDrop set to true, requiring the RowDD module. This allows vertical taskbar movement for reassignment, triggered by the rowDragStart and rowDrop events.
The following example enables drag-and-drop:
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, TaskFieldsModel, ResourceFieldsModel, EditSettingsModel, LabelSettingsModel, ColumnModel, RowDD, Inject, Edit, Toolbar, Selection, Resize } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
expandState: 'isExpand',
parentID: 'ParentID'
};
const resourceFields = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns = [
{ field: 'TaskID' },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar = ['ExpandAll', 'CollapseAll'];
const labelSettings = {
rightLabel: 'resources',
taskLabel: 'TaskName'
};
return (
<GanttComponent
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
allowTaskbarDragAndDrop={true}
projectStartDate={new Date('03/25/2019')}
projectEndDate={new Date('07/28/2019')}
viewType='ResourceView'
showOverAllocation={true}
enableMultiTaskbar={true}
height='450px'
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, TaskFieldsModel, ResourceFieldsModel, EditSettingsModel, LabelSettingsModel, ColumnModel, RowDD, Inject, Edit, Toolbar, Selection, Resize } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
expandState: 'isExpand',
parentID: 'ParentID'
};
const resourceFields: ResourceFieldsModel = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings: EditSettingsModel = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns: ColumnModel[] = [
{ field: 'TaskID' },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar: (string | object)[] = ['ExpandAll', 'CollapseAll'];
const labelSettings: LabelSettingsModel = {
rightLabel: 'resources',
taskLabel: 'TaskName'
};
return (
<GanttComponent
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
allowTaskbarDragAndDrop={true}
projectStartDate={new Date('03/25/2019')}
projectEndDate={new Date('07/28/2019')}
viewType='ResourceView'
showOverAllocation={true}
enableMultiTaskbar={true}
height='450px'
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>This configuration supports dynamic task reassignment.
Customize the taskbar based on resource view
You can customize the taskbar appearance based on resource view using the queryTaskbarInfo event.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, RowDD, Inject, Edit, Toolbar, Selection, Resize } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns = [
{ field: 'TaskID' },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar = ['ExpandAll', 'CollapseAll'];
const labelSettings = {
rightLabel: 'resources',
taskLabel: 'TaskName'
};
function queryTaskbarInfo(args) {
const group = args.data.taskData.resourceGroup;
if (typeof group === 'string') {
if (group === 'Planning Team') {
args.progressBarBgColor = 'red';
} else if (group === 'Testing Team') {
args.progressBarBgColor = 'green';
}
}
}
return (
<GanttComponent
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={new Date('03/25/2019')}
projectEndDate={new Date('07/28/2019')}
viewType='ResourceView'
enableMultiTaskbar={true}
height='450px'
queryTaskbarInfo={queryTaskbarInfo}
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, TaskFieldsModel, ResourceFieldsModel, EditSettingsModel, LabelSettingsModel, ColumnModel, RowDD, Inject, Edit, Toolbar, Selection, Resize, IQueryTaskbarInfoEventArgs } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskSettings: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields: ResourceFieldsModel = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings: EditSettingsModel = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const columns: ColumnModel[] = [
{ field: 'TaskID' },
{ field: 'TaskName', headerText: 'Name', width: 250 },
{ field: 'work', headerText: 'Work' },
{ field: 'Progress' },
{ field: 'resourceGroup', headerText: 'Group' },
{ field: 'StartDate' },
{ field: 'Duration' }
];
const toolbar: (string | object)[] = ['ExpandAll', 'CollapseAll'];
const labelSettings: LabelSettingsModel = {
rightLabel: 'resources',
taskLabel: 'TaskName'
};
function queryTaskbarInfo(args: IQueryTaskbarInfoEventArgs): void {
const group = (args.data as any).taskData.resourceGroup;
if (typeof group === 'string') {
if (group === 'Planning Team') {
args.progressBarBgColor = 'red';
} else if (group === 'Testing Team') {
args.progressBarBgColor = 'green';
}
}
}
return (
<GanttComponent
dataSource={data}
resources={resources}
taskFields={taskSettings}
resourceFields={resourceFields}
editSettings={editSettings}
columns={columns}
toolbar={toolbar}
labelSettings={labelSettings}
allowSelection={true}
allowResizing={true}
highlightWeekends={true}
treeColumnIndex={1}
projectStartDate={new Date('03/25/2019')}
projectEndDate={new Date('07/28/2019')}
viewType='ResourceView'
enableMultiTaskbar={true}
height='450px'
queryTaskbarInfo={queryTaskbarInfo}
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Hide columns in resource tab
To hide a column in the Gantt Chart’s resource view, handle the actionBegin event and set the visible property of the target column to false when the requestType is beforeOpenAddDialog or beforeOpenEditDialog.
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, RowDD, Inject, Edit, Toolbar, Selection, Resize, ActionBeginEventArgs } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar = ['Add'];
const labelSettings = {
leftLabel: 'TaskName'
};
function actionBegin(args) {
if (args.requestType === 'beforeOpenAddDialog' || args.requestType === 'beforeOpenEditDialog') {
args.Resources.columns[1].visible = false;
}
}
return (
<GanttComponent
height="430px"
dataSource={data}
taskFields={taskFields}
resourceFields={resourceFields}
resources={resources}
labelSettings={labelSettings}
toolbar={toolbar}
editSettings={editSettings}
actionBegin={actionBegin}
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { GanttComponent, TaskFieldsModel, ResourceFieldsModel, EditSettingsModel, LabelSettingsModel, RowDD, Inject, Edit, Toolbar, Selection, Resize, ActionBeginEventArgs } from '@syncfusion/ej2-react-gantt';
import { data, resources } from './datasource';
function App() {
const taskFields: TaskFieldsModel = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
endDate: 'EndDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Predecessor',
resourceInfo: 'resources',
work: 'work',
parentID: 'ParentID'
};
const resourceFields: ResourceFieldsModel = {
id: 'resourceId',
name: 'resourceName',
unit: 'resourceUnit',
group: 'resourceGroup'
};
const editSettings: EditSettingsModel = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar: (string | object)[] = ['Add'];
const labelSettings: LabelSettingsModel = {
leftLabel: 'TaskName'
};
function actionBegin(args: ActionBeginEventArgs) {
if (args.requestType === 'beforeOpenAddDialog' || args.requestType === 'beforeOpenEditDialog') {
args.Resources.columns[1].visible = false;
}
}
return (
<GanttComponent
height="430px"
dataSource={data}
taskFields={taskFields}
resourceFields={resourceFields}
resources={resources}
labelSettings={labelSettings}
toolbar={toolbar}
editSettings={editSettings}
actionBegin={actionBegin}
>
<Inject services={[RowDD, Edit, Toolbar, Selection, Resize]} />
</GanttComponent>
);
}
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Gantt</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="https://cdn.syncfusion.com/ej2/33.2.3/tailwind3.css" rel="stylesheet" type="text/css"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<style>
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
</style>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>Limitations
- Resource view does not support parent tasks; all tasks must be child tasks under resources or the Unassigned Task node.
- Unscheduled tasks (lacking start date or duration) are not supported in resource view.