# grid-detail-template

> Data grid with a detail row template that expands a row to reveal the shipped order lines and totals beneath it.

**Framework:** vue  **Component:** Grid  **Variant:** detail-template

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/vue/grid-detail-template.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-vue-grids
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/grid-detail-template/Grid.vue

```vue
<template>
<div class="col-lg-12">
  <div class="control-section">
    <ejs-grid :dataSource="data" height="460" :allowPaging="true" :pageSettings="pageSettings" :detailTemplate="'detailTemplate'" gridLines="Horizontal">
      <e-columns>
        <e-column field="OrderID" headerText="Order" width="110" :isPrimaryKey="true"></e-column>
        <e-column field="CustomerName" headerText="Customer" width="240"></e-column>
        <e-column field="ShipCity" headerText="City" width="160"></e-column>
        <e-column field="ShipCountry" headerText="Country" width="150"></e-column>
        <e-column field="Freight" headerText="Freight" width="120" format="C2" textAlign="Right"></e-column>
      </e-columns>
      <template v-slot:detailTemplate="{ data }">
        <div style="display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:16px;padding:16px 24px;background:#f8fafc">
          <div style="background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:16px">
            <h5 style="margin:0 0 12px;font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:#64748b">Shipment timeline</h5>
            <div style="display:flex;align-items:flex-start;gap:12px;margin-bottom:14px">
              <span style="width:10px;height:10px;margin-top:5px;border-radius:50%;background:#6366f1;box-shadow:0 0 0 4px #e0e7ff;flex-shrink:0"></span>
              <div>
                <div style="font-weight:600;color:#0f172a">Order placed</div>
                <div style="font-size:12px;color:#64748b">{{ fmt(data.OrderDate) }}</div>
              </div>
            </div>
            <div style="display:flex;align-items:flex-start;gap:12px">
              <span style="width:10px;height:10px;margin-top:5px;border-radius:50%;background:#6366f1;box-shadow:0 0 0 4px #e0e7ff;flex-shrink:0"></span>
              <div>
                <div style="font-weight:600;color:#0f172a">Shipped</div>
                <div style="font-size:12px;color:#64748b">{{ fmt(data.ShippedDate) }} · {{ days(data) }} days after order</div>
              </div>
            </div>
          </div>
          <div style="background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:16px">
            <h5 style="margin:0 0 12px;font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:#64748b">Delivery address</h5>
            <div style="font-weight:600;color:#0f172a">{{ data.ShipName }}</div>
            <div style="color:#475569;margin-top:4px">{{ data.ShipAddress }}</div>
            <div style="color:#475569">{{ data.ShipCity }}, {{ data.ShipCountry }}</div>
          </div>
          <div style="background:#fff;border:1px solid #e2e8f0;border-radius:12px;padding:16px">
            <h5 style="margin:0 0 12px;font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:#64748b">Freight charge</h5>
            <div style="font-size:28px;font-weight:700;color:#0f172a">${{ Number(data.Freight).toFixed(2) }}</div>
            <div style="font-size:12px;color:#64748b;margin-top:4px">Customer {{ data.CustomerID }}</div>
          </div>
        </div>
      </template>
    </ejs-grid>
  </div>
</div>
</template>

<script lang="ts">
import { GridComponent, ColumnDirective, ColumnsDirective, Page, DetailRow } from "@syncfusion/ej2-vue-grids";
import { orderData } from '../datasource/grid-data';

export default {
  components: { 'ejs-grid': GridComponent, 'e-column': ColumnDirective, 'e-columns': ColumnsDirective },
  data: function() {
    return { data: orderData, pageSettings: { pageSize: 8 } };
  },
  methods: {
    fmt: (d: any) => new Date(d).toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }),
    days: (o: any) => Math.max(0, Math.round((new Date(o.ShippedDate).getTime() - new Date(o.OrderDate).getTime()) / 86400000))
  },
  provide: { grid: [Page, DetailRow] }
}
</script>
```
