React Gantt - tasks
Configures tasks.

Use the dataSource property to bind the UI component to a data source, which contains tasks. If the field names in your data source differ from default names ('id', 'parentId', 'title', 'start', 'end', 'progress', 'color'), use appropriate properties (keyExpr, parentIdExpr, etc.) to map data fields.
Note that the 'id' and 'parentId' fields should not have the same value.
See Also
- import React from 'react';
- import 'devextreme/dist/css/dx.light.css';
- import 'devexpress-gantt/dist/dx-gantt.css';
- import Gantt, {
- Tasks,
- // ...
- } from 'devextreme-react/gantt';
- import {
- tasks,
- // ...
- } from './data.js';
- const App = () => {
- return (
- <Gantt ... >
- <Tasks
- dataSource={tasks}
- keyExpr="taskId"
- parentIdExpr="parentTaskId"
- titleExpr="taskTitle"
- progressExpr="taskProgress"
- startExpr="startDate"
- endExpr="endDate"
- colorExpr="taskColor" />
- {/* ... */}
- </Gantt>
- );
- };
- export default App;
- export const tasks = [{
- 'taskId': 1,
- 'parentTaskId': 0,
- 'taskTitle': 'Software Development',
- 'startDate': new Date('2019-02-21T05:00:00.000Z'),
- 'endDate': new Date('2019-07-04T12:00:00.000Z'),
- 'taskProgress': 31,
- 'taskColor': 'red'
- },
- // ...
- ];
dataSource
Binds the UI component to the data source which contains tasks.
Refer to the tasks property to see how to specify the dataSource property.
endExpr
Specifies the data field that provides tasks' end dates.
Refer to the tasks property to see how to specify the endExpr property.
keyExpr
Specifies the data field that provides keys for tasks.
Refer to the tasks property to see how to specify the keyExpr property.
parentIdExpr
Specifies the data field that provides tasks' parent IDs.
Refer to the tasks property to see how to specify the parentIdExpr property.
progressExpr
Specifies the data field that provides tasks' progress.
Refer to the tasks property to see how to specify the progressExpr property.
startExpr
Specifies the data field that provides tasks' start dates.
Refer to the tasks property to see how to specify the startExpr property.