ServerDataTable

Organism

Server-side paginated table. Reads page/totalPages/total/pageSize from the Express route; supports title, toolbar, clickable rows, and empty/loading states.

With title & pagination

Preview

Orders

142 total

OrderCustomerStatusTotal
#10421Alice JohnsonPaid$129.00
#10422Bob SmithPending$54.20
#10423Carol WhiteRefunded$320.00
#10424Dan BrownPaid$78.50

Showing 1–20 of 142

Code
<%- include('modules/ui/ServerDataTable', {
  title: 'Orders',
  subtitle: total + ' total',
  columns: [
    { key: 'orderId',  header: 'Order' },
    { key: 'customer', header: 'Customer' },
    { key: 'status',   header: 'Status' },
    { key: 'total',    header: 'Total', align: 'right' },
  ],
  rows: orders,
  page: page,
  totalPages: totalPages,
  total: total,
  pageSize: 20,
}) %>

<%-- In your Express route: --%>
<%
  // const page = parseInt(req.query.page) || 1;
  // const { orders, total } = await OrderService.list({ page, pageSize: 20 });
  // res.render('orders/index', { orders, total, page, totalPages: Math.ceil(total / 20) });
%>

Clickable rows + header action

Preview

Orders

Click a row to open

OrderCustomerStatusTotal
#10421Alice JohnsonPaid$129.00
#10422Bob SmithPending$54.20
#10423Carol WhiteRefunded$320.00
#10424Dan BrownPaid$78.50

Showing 21–40 of 142

Code
<%- include('modules/ui/ServerDataTable', {
  title: 'Orders',
  headerRight: '+ New order',
  columns: [...],
  rows: orders,
  page: page,
  totalPages: totalPages,
  total: total,
  pageSize: 20,
  getRowHref: function(row) { return '/orders/' + row.orderId.replace('#', ''); }
}) %>

Loading

Preview

Orders

Code
<%- include('modules/ui/ServerDataTable', {
  title: 'Orders',
  columns: [...],
  rows: [],
  loading: true
}) %>

Empty state

Preview

Orders

OrderCustomerStatusTotal
No orders yet. Your first sale will appear here.

Showing 1–0 of 0

Code
<%- include('modules/ui/ServerDataTable', {
  title: 'Orders',
  columns: [...],
  rows: [],
  page: 1,
  totalPages: 1,
  total: 0,
  pageSize: 20,
  emptyMessage: 'No orders yet. Your first sale will appear here.'
}) %>
Source modules/ui/Table/partials/server.ejs