-
AI-powered Extensions
-
Data Grid
-
Tree List
-
Chat
-
HTML Editor
-
Form
-
-
Data Grids / Data Management
-
Data Grid
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Grouping
-
Selection
- Focused Row
- Paging
-
Scrolling
-
Columns
- AI Assistant
-
Master-Detail
-
Data Summaries
-
Drag & Drop
-
Export to PDF
-
Export to Excel
- Appearance
-
Customization
- State Persistence
-
Adaptability
-
Keyboard Navigation
- Right-To-Left Support
-
Tree List
- Overview
-
Data Binding
-
Filtering
- Sorting
-
Editing
-
Selection
- Focused Row
- Paging
-
Columns
- Drag & Drop
- State Persistence
- Adaptability
-
Keyboard Navigation
-
Card View
-
Pivot Grid
- Overview
-
Data Binding
-
Field Management
-
Data Summaries
- Drill Down
- Filtering
-
Scrolling
-
Export to Excel
- Chart Integration
- Customization
- State Persistence
-
Filter Builder
-
-
Data Visualization
-
Charts
- Overview
-
Data Binding
-
Common Concepts
-
Axis
-
Aggregation
-
Tooltips
-
Selection
-
Customization
-
Zooming
-
Export
-
-
Area Charts
-
Bar Charts
- Bullet Charts
-
Doughnut Charts
-
Financial Charts
-
Funnel and Pyramid Charts
-
Line Charts
- Pareto Chart
-
Pie Charts
-
Point Charts
-
Polar and Radar Charts
-
Range Charts
- Sankey Chart
-
Sparkline Charts
-
Tree Map
-
Gauges
- Overview
-
Runtime update
-
Bar Gauge
-
Circular Gauge
-
Linear Gauge
-
Diagram
- Overview
-
Data Binding
-
Featured Shapes
-
Custom Shapes
-
Document Capabilities
-
User Interaction
- UI Customization
- Adaptability
-
-
Scheduling / Planning
-
Scheduler
- Overview
-
Data Binding
-
Views
-
Appointments
-
Timetable
- Editing
-
Grouping
- Virtual Scrolling
- Drag & Drop
-
Customization
- Adaptability
-
Gantt
- Overview
- Data Binding
-
Filtering
- Sorting
- Strip Lines
- Export to PDF
- Validation
-
Customization
-
-
Messaging
-
WYSIWYG Editor
-
Forms
-
Data Editors
- Overview
-
Common Concepts
-
Calendar
- Check Box
- Color Box
-
Date Box
-
Date Range Box
-
Number Box
- Radio Group
-
Range Selector
- Range Slider
- Slider
- Switch
- Text Area
- Text Box
-
Drop-Downs
- Autocomplete
-
Drop Down Box
-
Select Box
-
Tag Box
-
Lookup
-
Buttons
-
File Upload / File Management
-
File Manager
- Overview
-
File System Types
-
Customization
-
File Uploader
-
-
Popup and Notifications
-
Navigation
- Overview
- Accordion
-
Action Sheet
-
Context Menu
-
Menu
- Multi View
-
Drawer
-
Tab Panel
-
Tabs
-
Toolbar
-
Stepper
- Pagination
-
List
-
Tree View
- Right-to-Left Support
-
Layout
-
Tile View
- Splitter
-
Gallery
- Scroll View
- Box
- Responsive Box
-
-
Interactive Wrappers
-
Sortable
- Resizable
-
-
Progress Indicators
-
Maps
- Overview
-
Map
-
Vector Map
-
Data Binding
- Multiple Layers
-
Markers
- Legend
-
Zooming and Panning
-
Customization
-
-
Localization
Related Demos:
Your search did not match any results.
Vue Data Grid - Advanced Master-Detail View
This demo illustrates an advanced master-detail view in the DataGrid component. Master rows represent suppliers. Detail sections contain TabPanel components with two tabs: Orders and Address. In the Orders tab, you can choose a supplier's product from the SelectBox, and the DataGrid under it will show orders placed on this product. The Address tab displays the supplier's address.
Backend API
<template>
<DxDataGrid
id="gridContainer"
:data-source="suppliersData"
:remote-operations="true"
:show-borders="true"
>
<DxPaging :page-size="15"/>
<DxPager :visible="true"/>
<DxColumn data-field="ContactName"/>
<DxColumn data-field="ContactTitle"/>
<DxColumn data-field="CompanyName"/>
<DxColumn data-field="City"/>
<DxColumn data-field="Country"/>
<DxMasterDetail
:enabled="true"
template="master-detail"
/>
<template #master-detail="{ data }">
<MasterDetail :master-detail-data="data"/>
</template>
</DxDataGrid>
</template>
<script setup lang="ts">
import {
DxDataGrid,
DxColumn,
DxPaging,
DxPager,
DxMasterDetail,
} from 'devextreme-vue/data-grid';
import { createStore } from 'devextreme-aspnet-data-nojquery';
import MasterDetail from './MasterDetail.vue';
const url = 'https://js.devexpress.com/Demos/NetCore/api/DataGridAdvancedMasterDetailView';
const suppliersData = createStore({
key: 'SupplierID',
loadUrl: `${url}/GetSuppliers`,
});
</script>
<template>
<DxForm
:form-data="data"
:items="items"
:col-count="2"
:customize-item="customizeItem"
class="address-form form-container"
>
<template #form-item="{ data: item }">
<span>
{{ item.editorOptions.value }}
</span>
</template>
</DxForm>
</template>
<script setup lang="ts">
import { DxForm, type DxFormTypes } from 'devextreme-vue/form';
import { type Supplier } from './data.ts';
defineProps<{
data: Supplier
}>();
const items = [
{ dataField: 'Address' },
{ dataField: 'City' },
{ dataField: 'Region' },
{ dataField: 'PostalCode' },
{ dataField: 'Country' },
{ dataField: 'Phone' },
];
const customizeItem = (item: DxFormTypes.SimpleItem) => {
item.template = 'form-item';
};
</script>
<template>
<DxTabPanel>
<DxItem
title="Orders"
template="orders-tab"
/>
<template #orders-tab>
<OrdersTab
:supplier-id="masterDetailData.key"
/>
</template>
<DxItem
title="Address"
template="address-tab"
/>
<template #address-tab>
<AddressTab
:data="masterDetailData.data"
/>
</template>
</DxTabPanel>
</template>
<script setup lang="ts">
import { DxTabPanel, DxItem } from 'devextreme-vue/tab-panel';
import OrdersTab from './OrdersTab.vue';
import AddressTab from './AddressTab.vue';
import { type Supplier } from './data.ts';
defineProps<{
masterDetailData: {
key: number,
data: Supplier
}
}>();
</script>
<template>
<div>
<DxDataGrid
:data-source="orderHistoryStore"
:show-borders="true"
>
<DxPaging :page-size="5"/>
<DxColumn data-field="OrderID"/>
<DxColumn
data-field="OrderDate"
data-type="date"
/>
<DxColumn data-field="ShipCountry"/>
<DxColumn data-field="ShipCity"/>
<DxColumn
data-field="UnitPrice"
format="currency"
/>
<DxColumn data-field="Quantity"/>
<DxColumn
data-field="Discount"
format="percent"
/>
<DxSummary>
<DxTotalItem
column="UnitPrice"
summary-type="sum"
>
<DxValueFormat
:precision="2"
format="currency"
/>
</DxTotalItem>
<DxTotalItem
column="Quantity"
summary-type="count"
/>
</DxSummary>
</DxDataGrid>
</div>
</template>
<script setup lang="ts">
import {
DxDataGrid, DxColumn, DxPaging, DxSummary, DxTotalItem, DxValueFormat,
} from 'devextreme-vue/data-grid';
import { createStore } from 'devextreme-aspnet-data-nojquery';
import { computed } from 'vue';
const props = defineProps<{
productId: number | null
}>();
const url = 'https://js.devexpress.com/Demos/NetCore/api/DataGridAdvancedMasterDetailView';
const orderHistoryStore = computed(() => (props.productId === null ? undefined : {
store: createStore({
key: 'OrderID',
loadParams: { ProductID: props.productId },
loadUrl: `${url}/GetOrdersByProduct`,
}),
}));
</script>
<template>
<DxForm
label-location="top"
class="form-container"
>
<DxItem template="select-box">
<DxLabel text="Product"/>
</DxItem>
<template #select-box>
<ProductSelectBox
:supplier-id="supplierId"
@product-changed="chosenProductId = $event"
/>
</template>
<DxItem template="order-history">
<DxLabel text="Order History"/>
</DxItem>
<template #order-history>
<OrderHistory
:product-id="chosenProductId"
/>
</template>
</DxForm>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { DxForm, DxItem, DxLabel } from 'devextreme-vue/form';
import ProductSelectBox from './ProductSelectBox.vue';
import OrderHistory from './OrderHistory.vue';
defineProps<{
supplierId: number
}>();
const chosenProductId = ref<null | number>(null);
</script>
<template>
<DxSelectBox
:defer-rendering="false"
:data-source="dataSource"
:input-attr="{ 'aria-label': 'Product' }"
:value="productId"
value-expr="ProductID"
display-expr="ProductName"
@valueChanged="$emit('product-changed', $event.value)"
/>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import DxSelectBox from 'devextreme-vue/select-box';
import { createStore } from 'devextreme-aspnet-data-nojquery';
import { type Product } from './data.ts';
defineEmits(['product-changed']);
const props = defineProps<{
supplierId: number
}>();
const url = 'https://js.devexpress.com/Demos/NetCore/api/DataGridAdvancedMasterDetailView';
const dataSource = createStore({
key: 'ProductID',
loadParams: { SupplierID: props.supplierId },
loadUrl: `${url}/GetProductsBySupplier`,
onLoaded: setDefaultValue,
});
const productId = ref<number>();
function setDefaultValue(items: Product[]) {
const firstItem = items[0];
if (firstItem && productId.value === undefined) {
productId.value = firstItem.ProductID;
}
}
</script>
export type Supplier = {
SupplierID: number;
CompanyName: string;
ContactName: string;
ContactTitle: string;
Address: string;
City: string;
Region: string | null;
PostalCode: string;
Country: string;
Phone: string;
Fax: string | null;
HomePage: string | null;
};
export type Product = {
ProductID: number;
ProductName: string
SupplierID: number;
CategoryID: number;
QuantityPerUnit: string
UnitPrice: number
UnitsInStock: number
UnitsOnOrder: number
ReorderLevel: number
Discontinued: boolean;
};
export type Order = {
OrderID: number;
OrderDate: Date;
ShipCountry: string;
ShipCity: string;
UnitPrice: number;
Quantity: number;
Discount: number;
};
import { createApp } from 'vue';
import App from './App.vue';
createApp(App).mount('#app');
#gridContainer {
height: 620px;
}
.dx-datagrid-rowsview .dx-master-detail-row:not(.dx-datagrid-edit-form) > .dx-datagrid-group-space,
.dx-datagrid-rowsview .dx-master-detail-row:not(.dx-datagrid-edit-form) .dx-master-detail-cell {
background-color: transparent;
}
.form-container {
padding: 20px;
}
.address-form label {
font-weight: bold;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" />
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" />
<link rel="stylesheet" type="text/css" href="./bundle.css" />
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="app" />
</div>
<script src="bundles/vendor/vue.vendor.js"></script>
<script src="./bundle.js"></script>
</body>
</html>