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
18.2
18.1
17.2
A newer version of this page is available. Switch to the current version.

DevExtreme jQuery - Group Appointments by Resources

To group appointments by resources, assign an array to the groups option. Each element of this array is fieldExpr of a resource kind. Note that the resource headers' order depends on the resources' order in the resources array.

jQuery
JavaScript
var appointments = [{ 
    roomId: 1,   
    teacherId: 2,    
    text: "Meeting",
    // ...
}, 
// ...
];

var resources = [
    { fieldExpr: 'roomId', dataSource: roomsDataSource },
    { fieldExpr: 'teacherId', dataSource: teachersDataSource }
];

$(function(){
    $("#schedulerContainer").dxScheduler({
        dataSource: appointments,
        resources: resources,
        // Groups appointments by rooms and by teachers
        groups: ['roomId', 'teacherId']
        //...
    });
});
Angular
HTML
TypeScript
<dx-scheduler 
    [dataSource]="appointments"
    [groups]="['roomId', 'teacherId']"> <!-- Groups appointments by rooms and by teachers -->
    <dxi-resource
        fieldExpr="roomId"
        [dataSource]="roomResources">
    </dxi-resource>
    <dxi-resource
        fieldExpr="teacherId"
        [dataSource]="teacherResources">
    </dxi-resource>
</dx-scheduler>
import { DxSchedulerModule } from "devextreme-angular";
// ...
export class AppComponent  { 
    // ...
    appointments = [{ 
        roomId: 1,   
        teacherId: 2,    
        text: "Meeting",
        // ...
    }, 
    // ...
    ];
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule
    ],
    // ...
})

Scheduler Grouping by Resources

You can change resource headers' orientation in an individual view using the views.groupOrientation option. In the following code, the orientation in the day view is "vertical", so that resource headers are arranged in a column:

jQuery
JavaScript
$(function(){
    $("#schedulerContainer").dxScheduler({
        // ...
        views: ["month", {
            type: "day",
            groupOrientation: "vertical"
        }]
    });
});
Angular
TypeScript
HTML
import { DxSchedulerModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
    views = ["month", {
        type: "day",
        groupOrientation: "vertical"
    }];
}
@NgModule({
    imports: [
        // ...
        DxSchedulerModule
    ],
    // ...
})
<dx-scheduler ... 
    [views]="views">
</dx-scheduler>

View Demo

See Also