DevExtreme Vue - Master-Detail Interface
User Interaction
The master-detail interface supplies a standard data row with an expandable section that contains detail data. In master-detail terms, the data row is called "master row" and the expandable section - "detail section".

The master-detail interface becomes available after you specify the detail sections' contents using the masterDetail.template option. You can expand and collapse detail sections programmatically or enable a user to do it by setting the masterDetail.enabled option to true. Set the masterDetail.autoExpandAll option to true to expand these sections by default.
jQuery
$(function() {
    $("#dataGridContainer").dxDataGrid({
        // ...
        masterDetail: {
            enabled: true,
            autoExpandAll: true,
            template: function (container, info) {
                var currentEmployeeData = info.data;
                container.append(
                    $('<div class="employeeInfo">
                        <img class="employeePhoto" src="' + currentEmployeeData.Picture + '" />
                        <p class="employeeNotes">' + currentEmployeeData.Notes + '</p>
                    </div>'));
            } 
        }
    });
});Angular
<dx-data-grid ...
    [masterDetail]="{ enabled: true, template: 'detail', autoExpandAll: true }">
    <div *dxTemplate="let employee of 'detail'">
        <div class="employeeInfo">
            <img class="employeePhoto" [src]="employee.data.Picture" />
            <p class="employeeNotes">{{employee.data.Notes}}</p>
        </div>
    </div>
</dx-data-grid>
import { DxDataGridModule } from "devextreme-angular";
// ...
export class AppComponent {
    // ...
}
@NgModule({
    imports: [
        // ...
        DxDataGridModule
    ],
    // ...
})Once loaded, a detail section's content remains cached until a user switches to another page in the DataGrid or reloads the web page.
API
Pass -1 to the expandAll(groupIndex) or collapseAll(groupIndex) method to expand or collapse all master rows at once.
jQuery
var dataGrid = $("#dataGridContainer").dxDataGrid("instance");
dataGrid.expandAll(-1);
dataGrid.collapseAll(-1);Angular
import { ..., ViewChild } from "@angular/core";
import { DxDataGridModule, DxDataGridComponent } from "devextreme-angular";
// ...
export class AppComponent {
    @ViewChild(DxDataGridComponent, { static: false }) dataGrid: DxDataGridComponent;
    // Prior to Angular 8
    // @ViewChild(DxDataGridComponent) dataGrid: DxDataGridComponent;
    expandAllMasterRows () {
        this.dataGrid.instance.expandAll(-1);
    }
    collapseAllMasterRows () {
        this.dataGrid.instance.collapseAll(-1);
    }
}
@NgModule({
    imports: [
        // ...
        DxDataGridModule
    ],
    // ...
})The expandRow(key) and collapseRow(key) methods expand and collapse an individual master row. You can check a row's current state by calling the isRowExpanded(key) method.
jQuery
function toggleMasterRow (rowKey) {
    var dataGrid = $("#dataGridContainer").dxDataGrid("instance");
    if (dataGrid.isRowExpanded(rowKey)) {
        dataGrid.collapseRow(rowKey);
    } else {
        dataGrid.expandRow(rowKey);
    }
}Angular
import { ..., ViewChild } from "@angular/core";
import { DxDataGridModule, DxDataGridComponent } from "devextreme-angular";
// ...
export class AppComponent {
    @ViewChild(DxDataGridComponent, { static: false }) dataGrid: DxDataGridComponent;
    // Prior to Angular 8
    // @ViewChild(DxDataGridComponent) dataGrid: DxDataGridComponent;
    toggleMasterRow (rowKey) {
        if (this.dataGrid.instance.isRowExpanded(rowKey)) {
            this.dataGrid.instance.collapseRow(rowKey);
        } else {
            this.dataGrid.instance.expandRow(rowKey);
        }
    }
}
@NgModule({
    imports: [
        // ...
        DxDataGridModule
    ],
    // ...
})Events
Events raised for a master row when a user expands or collapses it are identical to the events raised for expanding or collapsing a group. See this topic for details.
If you have technical questions, please create a support ticket in the DevExpress Support Center.