PAD Showcase
All tags/Data table

Orders with totals

Columns picked and labelled, numbers right-aligned with the same decimals, a totals row, and header links that sort on the server.

1 The data datatable/orders.php php
<?php

  // The orders of a week, as a database answers them.

  $orders = [
    [ 'number' => 10412, 'date' => '2026-10-05', 'customer' => 'Atelier Graphique',  'items' => 3,  'total' => 1245.5,  'status' => 'paid'    ],
    [ 'number' => 10413, 'date' => '2026-10-05', 'customer' => 'Signal Gift Stores', 'items' => 1,  'total' => 89.9,    'status' => 'paid'    ],
    [ 'number' => 10414, 'date' => '2026-10-06', 'customer' => 'Mini Wheels Co.',    'items' => 12, 'total' => 4310,    'status' => 'shipped' ],
    [ 'number' => 10415, 'date' => '2026-10-06', 'customer' => 'Land of Toys Inc.',  'items' => 5,  'total' => 642.25,  'status' => 'paid'    ],
    [ 'number' => 10416, 'date' => '2026-10-07', 'customer' => 'Baane Mini Imports', 'items' => 2,  'total' => 318,     'status' => 'open'    ],
    [ 'number' => 10417, 'date' => '2026-10-08', 'customer' => 'Euro+ Shopping',     'items' => 8,  'total' => 2975.75, 'status' => 'open'    ],
  ];

?>
2 The tag datatable/orders.pad pad
{datatable data='orders', columns='number, date, customer, items, total', totals='items, total', format="date:date('j M Y')", sortable, striped, caption='Orders this week'}
3 The result rendered on the server
Orders this week
Number Date Customer Items Total
10412 5 Oct 2026 Atelier Graphique 3 1,245.50
10416 7 Oct 2026 Baane Mini Imports 2 318.00
10417 8 Oct 2026 Euro+ Shopping 8 2,975.75
10415 6 Oct 2026 Land of Toys Inc. 5 642.25
10414 6 Oct 2026 Mini Wheels Co. 12 4,310.00
10413 5 Oct 2026 Signal Gift Stores 1 89.90
Total 31 9,581.40