# 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:** angular  **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/angular/grid-detail-template.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-angular-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.component.html

```html
<div style="margin: 50px 90px">
  <ejs-grid [dataSource]='data' height='460' [allowPaging]='true' [pageSettings]='pageSettings' gridLines='Horizontal'>
    <ng-template #detailTemplate let-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">{{ data.OrderDate | date: 'mediumDate' }}</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">{{ data.ShippedDate | date: 'mediumDate' }} · {{ 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">{{ data.Freight | currency }}</div>
          <div style="font-size:12px;color:#64748b;margin-top:4px">Customer {{ data.CustomerID }}</div>
        </div>
      </div>
    </ng-template>
    <e-columns>
      <e-column field='OrderID' headerText='Order' width='110' isPrimaryKey='true'></e-column>
      <e-column field='ShipName' headerText='Ship To' 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>
  </ejs-grid>
</div>
```

### src/components/grid-detail-template/grid.component.ts

```typescript
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { GridModule, PageService, DetailRowService } from '@syncfusion/ej2-angular-grids';
import { orderData } from '../datasource/grid-data';

@Component({
  selector: 'app-grid-detail-template',
  standalone: true,
  imports: [CommonModule, GridModule],
  providers: [PageService, DetailRowService],
  templateUrl: './grid.component.html'
})
export class DetailTemplateComponent {
  public data: Object[] = orderData;
  public pageSettings = { pageSize: 8 };

  public days(o: any): number {
    return Math.max(0, Math.round((new Date(o.ShippedDate).getTime() - new Date(o.OrderDate).getTime()) / 86400000));
  }
}
```
