All docs
V19.2
24.1
The page you are viewing does not exist in version 24.1.
23.2
The page you are viewing does not exist in version 23.2.
23.1
The page you are viewing does not exist in version 23.1.
22.2
The page you are viewing does not exist in version 22.2.
22.1
The page you are viewing does not exist in version 22.1.
21.2
The page you are viewing does not exist in version 21.2.
21.1
The page you are viewing does not exist in version 21.1.
20.2
The page you are viewing does not exist in version 20.2.
20.1
The page you are viewing does not exist in version 20.1.
19.2
19.1
The page you are viewing does not exist in version 19.1.
18.2
The page you are viewing does not exist in version 18.2.
18.1
The page you are viewing does not exist in version 18.1.
17.2
The page you are viewing does not exist in version 17.2.
A newer version of this page is available. Switch to the current version.

jQuery Gantt - resources

Configures task resources.

Type:

Object

Default Value: null

View Demo

You can add resources to a project and assign them to tasks. Resources can be people responsible for tasks, equipment, materials, etc. The Gantt displays resources as labels on the right of the tasks.

DevExtreme Gantt Chart - Resources

Use the dataSource option to bind the widget to a data source, which contains resources. If the field names in your data source differ from the 'id' and 'text' default names, use the keyExpr and/or textExpr options to map data fields.

See Also
jQuery
index.js
data.js
$(function() {
    $("#gantt").dxGantt({
        resources: {
            dataSource: resources,
            keyExpr: "resourceId",
            textExpr: "title"
        },
        //...
    });
});
var resources = [{
    'resourceId': 1,
    'title': 'Management'
}, 
// ...
];    
Angular
app.component.html
app.component.ts
app.module.ts
app.service.ts
<dx-gantt ... >
    <dxo-resources 
        [dataSource]="resources" 
        keyExpr="resourceId"
        textExpr="title">
    </dxo-resources>
    <!-- ... -->
</dx-gantt>
import { Component } from '@angular/core';

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
})

export class AppComponent {
    resources: Resource[];
    // ...
    constructor(service: Service) {
        this.resources = service.getResources();
        // ...
    }        
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { DxGanttModule } from 'devextreme-angular';
import { Service, Resource, ... } from './app.service';

@NgModule({
    imports: [
        BrowserModule,
        DxGanttModule
    ],
    providers: [Service],
    declarations: [AppComponent],
    bootstrap: [AppComponent]
})
export class AppModule { }
import { Injectable } from '@angular/core';

export class Resource {
    id: number;
    text: string;
}

const resources: Resource[] = [{
    'resourceId': 1,
    'title': 'Management'
},
// ...   
]; 
@Injectable()
export class Service {
    getResources(): Resource[] {
        return resources;
    }
}    
Vue
App.vue
data.js
<template>
    <DxGantt ... >
        <DxResources 
            :data-source="resources"
            key-expr="resourceId"
            text-expr="title" />
        <!-- ... -->
    </DxGantt>
</template>
<script>
    import 'devextreme/dist/css/dx.common.css';
    import 'devextreme/dist/css/dx.light.css'; 

    import { 
        DxGantt, 
        DxResources, 
        // ... 
    } from 'devextreme-vue/gantt';
    import { 
        resources, 
        // ... 
    } from './data.js';

    export default {
        components: { 
            DxGantt, 
            DxResources, 
            // ... 
        },
        data() {
            return { 
                resources, 
                // ... 
            };
        }
    };
</script>
export const resources = [{
    'resourceId': 1,
    'title': 'Management'
},
// ...
];  
React
App.js
data.js
import React from 'react';

import 'devextreme/dist/css/dx.common.css';
import 'devextreme/dist/css/dx.light.css';

import Gantt, { 
    Resources, 
    // ... 
} from 'devextreme-react/gantt';
import { 
    resources, 
    // ... 
} from './data.js';

class App extends React.Component {
    render() {
        return (
            <Gantt ... >
                <Resources 
                    dataSource={resources}
                    keyExpr="resourceId"
                    textExpr="title" />
                {/* ... */}
            </Gantt>
        );
    }
}
export default App;
export const resources = [{
    'resourceId': 1,
    'title': 'Management'
},
// ...
];

dataSource

Binds the widget to the data source, which contains resources.

Default Value: null

Refer to the resources option to see how to specify the dataSource option.

keyExpr

Specifies the data field that provides keys for resources.

Type:

String

|

Function

Default Value: 'id'

Refer to the resources option to see how to specify the keyExpr option.

textExpr

Specifies the data field that provides resource texts.

Type:

String

|

Function

Default Value: 'text'

Refer to the resources option to see how to specify the textExpr option.