Moey Icons
No results. Try “dialog”, “dark” or “grid”.
Moey extras

Data table

Search, filter, sort, page, select, edit and export — on any table. Add one attribute to the HTML you already have, or hand it data from JavaScript.

Order Customer Date Status Items Total
#10440 SOSam Okafor Sep 4, 2026 Shipped 4 $224.74
#10439 AKAna Kim Oct 17, 2026 Cancelled 5 $148.53
#10438 NBNoah Berg Sep 14, 2026 Paid 1 $334.54
#10437 ÉMÉlodie Martin Sep 5, 2026 Shipped 6 $462.78
#10436 MRMax Ruiz Sep 27, 2026 Shipped 4 $213.23
#10435 NBNoah Berg Nov 5, 2026 Pending 2 $225.91
#10434 ÉMÉlodie Martin Nov 5, 2026 Pending 3 $180.81
#10433 AKAna Kim Nov 7, 2026 Cancelled 2 $237.94
#10432 NBNoah Berg Oct 22, 2026 Shipped 2 $77.28
#10431 SOSam Okafor Oct 2, 2026 Paid 4 $338.85
#10430 ZLZoë Laurent Oct 13, 2026 Pending 6 $222.64
#10429 SOSam Okafor Sep 8, 2026 Shipped 1 $368.65
#10428 LTLena Torres Nov 25, 2026 Refunded 6 $456.89
#10427 MCMia Chen Sep 16, 2026 Refunded 3 $167.35
#10426 LTLena Torres Nov 20, 2026 Pending 6 $140.02
#10425 AKAna Kim Oct 17, 2026 Pending 6 $54.93
#10424 SOSam Okafor Oct 17, 2026 Cancelled 5 $72.05
#10423 OHOmar Haddad Sep 1, 2026 Pending 5 $351.40
#10422 NBNoah Berg Nov 7, 2026 Cancelled 1 $92.96
#10421 AKAna Kim Nov 16, 2026 Paid 1 $416.75
#10420 SOSam Okafor Oct 8, 2026 Paid 3 $42.77
#10419 LTLena Torres Sep 23, 2026 Pending 1 $91.00
#10418 NBNoah Berg Sep 12, 2026 Paid 3 $241.46
#10417 AKAna Kim Nov 13, 2026 Refunded 6 $174.14
#10416 MCMia Chen Oct 8, 2026 Refunded 6 $49.04
#10415 AKAna Kim Sep 6, 2026 Paid 4 $26.16
#10414 SOSam Okafor Nov 16, 2026 Pending 3 $265.51
#10413 MRMax Ruiz Oct 19, 2026 Cancelled 5 $447.07
#10412 SOSam Okafor Oct 25, 2026 Cancelled 5 $250.86
#10411 MCMia Chen Nov 16, 2026 Cancelled 5 $316.88
#10410 SOSam Okafor Oct 28, 2026 Paid 3 $325.11
#10409 MCMia Chen Oct 15, 2026 Refunded 5 $435.57
#10408 AKAna Kim Nov 14, 2026 Pending 1 $328.25
#10407 NBNoah Berg Oct 6, 2026 Paid 1 $163.15
#10406 ZLZoë Laurent Oct 1, 2026 Shipped 4 $100.27
#10405 LTLena Torres Nov 9, 2026 Refunded 3 $299.62
#10404 OHOmar Haddad Oct 10, 2026 Paid 4 $441.19
#10403 AKAna Kim Sep 14, 2026 Paid 4 $204.98
#10402 JDJane Doe Nov 2, 2026 Paid 4 $230.99
#10401 ZLZoë Laurent Sep 12, 2026 Paid 1 $199.22
<div class="datatable" data-moey-page-size="8">
  <button class="btn btn-default btn-sm" data-moey-toolbar>New order</button>                <!-- goes in the toolbar -->
  <button class="btn btn-red btn-subtle btn-sm" data-moey-bulk-action="delete">Delete</button>   <!-- shows when rows are selected -->
  <table class="table table-hover">
    <thead>
      <tr>
        <th class="table-check"><input type="checkbox" class="form-check-input"></th>   <!-- selectable rows -->
        <th>Order</th>
        <th>Customer</th>
        <th data-type="date">Date</th>
        <th data-moey-filter="select">Status</th>        <!-- a dropdown filter -->
        <th class="text-end" data-moey-hidden>Items</th>  <!-- hidden until picked in View -->
        <th class="text-end">Total</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="table-check">
          <input type="checkbox" class="form-check-input">
        </td>
        <td><a href="/orders/10440">#10440</a></td>
        <td>…</td>
        <td data-sort="2026-11-14">Nov 14, 2026</td>
        <td><span class="badge badge-green badge-subtle">Paid</span></td>
        <td class="text-end">3</td>
        <td class="text-end">$129.00</td>
      </tr>
      …
    </tbody>
  </table>
</div>

That's plain HTML — the rows can come from PHP, Laravel, Django, Rails, anything. Without the wrapper, <table class="table" data-moey-datatable> is enough. Try it:

  • Search any column — matches are highlighted. The Status dropdown filters.
  • Sort by clicking a header; Shift-click another to sort by both (the numbers show the order). Dates, money and numbers sort as values, not text.
  • Select rows — Shift-click a checkbox for a range. Selection survives paging and sorting; the bar offers "Select all" across pages and your bulk buttons (they fire moey:bulk).
  • View menu: show or hide columns (Items starts hidden), density, export the rows (or just the selected ones) as CSV, or copy them for a spreadsheet.
  • Resize a column by dragging the edge of its header; double-click the edge to reset. On a phone, data-moey-stack turns rows into cards.

Edit inside the table

Two ways to change data where it is. Editable cells turn into a field when you double-click them (or press Enter / F2): Enter saves, Esc cancels, Tab saves and moves to the next one — like a spreadsheet. Controls in cells — switches, checkboxes, selects, numbers — are always there and save the moment they change. Both follow the column's rules, and moey:edit can say no.

Order Customer Status Due Qty Gift Paid
#10421Ana KimPaid2026-12-022noyes
#10420Marco RossiPending2026-12-041yesno
#10419Lena FischerRefunded2026-11-283noyes
#10418Sam OkaforPending2026-12-061nono

Double-click a customer, a status or a date — or flip a switch. Try leaving the customer empty.

<div class="datatable" data-moey-stack>
  <button class="btn btn-default btn-sm" data-moey-toolbar data-moey-add>Add order</button>
  <table class="table">
    <thead>
      <tr>
        <th>Order</th>
        <th data-moey-editor="text" data-moey-required>Customer</th>
        <th data-moey-editor="select" data-moey-options="Paid,Pending,Refunded">Status</th>
        <th data-moey-editor="date">Due</th>
        <th data-moey-control="number" data-moey-min="0" data-moey-max="99">Qty</th>
        <th data-moey-control="checkbox">Gift</th>
        <th data-moey-control="switch">Paid</th>
      </tr>
    </thead>
    <tbody>…</tbody>
  </table>
</div>

<script>
  orders.addEventListener('moey:edit', (e) => {
    const { row, key, value, old } = e.detail;
    if (key === 'status' && old === 'Refunded') e.preventDefault();   // say no: the old value comes back
    else save(row, key, value);                                        // send it to your server
  });
  orders.addEventListener('moey:add', (e) => { /* a new row was added (cancelable) */ });
</script>
On a column (<th>)What it does
data-moey-editor="text|number|select|date|email|url|tel"The cell is editable with that kind of field (numbers and money columns get a number field by themselves)
data-moey-options="Paid,Pending,Refunded"The choices of a select editor or control (without it: the values already in the column)
data-moey-required · data-moey-min · data-moey-max · data-moey-pattern · data-moey-stepThe rules: a value that breaks them isn't saved (the reason is shown, and read out)
data-moey-control="switch|checkbox|select|number"A live control in every cell of the column; changes save at once (search, sort and CSV use the value)
data-moey-add on a toolbar buttonAdds a row at the top and opens its first editable cell · from code: dt.add(values, { edit: true })

Nested rows

Never put a table inside a table cell — the borders double, the columns get cramped, and on a phone it scrolls sideways inside something that scrolls sideways. Pick the pattern that fits the data instead:

Your data looks likeUseFor example
A row has more about itselfExpandable rows — a panel opens under the rowAn order → its items and address
Rows contain rows of the same kindTree rows — children indented, same columnsCategories → products, folders → files
Rows belong to a categoryGrouped rows — a header per group, with totalsOrders by status

Expandable rows

A chevron opens a panel under the row — anything fits in it: a description list, a small list, line items. The header chevron opens them all.

Moey.datatable('#orders', {
  columns: [ … ],
  data: orders,
  detail: (order) => `
    <dl class="dl dl-sm">
      <dt>Items</dt><dd>${order.items.join(', ')}</dd>
      <dt>Ship to</dt><dd>${order.address}</dd>
    </dl>`,
});

<!-- or in the HTML: a <template data-moey-detail> in any cell of the row -->
<tr>
  <td>#10421 <template data-moey-detail><p>2 × Linen tote …</p></template></td>
  <td>Ana Kim</td> …
</tr>

Tree rows

Children sit under their parent, indented, in the same columns — so everything still lines up and sorts. Search keeps the path to each match and opens it. With the keyboard: → opens, ← closes or goes up to the parent. Screen readers hear a tree ("level 2, 3 of 5, expanded").

Moey.datatable('#catalog', {
  columns: [{ key: 'name', label: 'Name' }, { key: 'stock', label: 'Stock', format: 'number' }, { key: 'price', label: 'Price', format: 'currency' }],
  data: [
    { id: 'bags', name: 'Bags', stock: 432, children: [
      { id: 'tote', name: 'Linen tote', stock: 120, price: 29 },
      { id: 'canvas', name: 'Canvas bag', stock: 312, price: 24 },
    ] },
    …
  ],
  expanded: ['bags'],        // open at the start
});

<!-- or in the HTML: data-parent on the child rows -->
<tr data-id="bags"><td>Bags</td> …</tr>
<tr data-id="tote" data-parent="bags"><td>Linen tote</td> …</tr>

Grouped rows

groupBy (or data-moey-group-by) puts rows under a header per value, with the count and totals of the columns you mark with sum: true (data-moey-sum on a <th>). Headers stick while you scroll and fold their group away.

Moey.datatable('#orders', {
  columns: [
    { key: 'id', label: 'Order' },
    { key: 'status', label: 'Status' },
    { key: 'total', label: 'Total', format: 'currency', sum: true },
  ],
  data: orders,
  groupBy: 'status',
});

<!-- or -->
<div class="datatable" data-moey-group-by="status">
  <table class="table"><thead><tr>… <th data-moey-sum>Total</th></tr></thead> …</table>
</div>

On phones all three become their card versions: the chevron sits in the card and the detail hangs under it; child cards are indented; groups become section headings.

Very long tables

For thousands of rows — a full order history, a log, a product catalog — add data-moey-virtual (or virtual: true). All the rows live in one scrolling area instead of pages, but only the ones you can see are actually drawn, so 10,000 rows scroll as smoothly as 10. Search, sort, filters, selection and editing all keep working on every row.

10,000 orders, made up in the browser. Scroll, search ("Lisbon"), sort a column, select rows.

const orders = Moey.datatable('#orders', {
  columns: [
    { key: 'id', label: 'Order' },
    { key: 'customer', label: 'Customer' },
    { key: 'city', label: 'City', filter: 'select' },
    { key: 'total', label: 'Total', format: 'currency', currency: 'USD' },
    { key: 'status', label: 'Status', format: 'badge', colors: { Paid: 'green', Pending: 'amber', Refunded: 'gray' } },
  ],
  data: tenThousandOrders,
  virtual: true,            // one scrolling list, drawn only where you look
  height: '28rem',          // how tall the scrolling area is (32rem by default)
  select: true,
});

<!-- or on a table you already have -->
<div class="datatable" data-moey-virtual data-moey-height="28rem">
  <table class="table">…thousands of rows…</table>
</div>
  1. Turn it on with data-moey-virtual on the .datatable (or virtual: true). The page-size menu and the pages go away; the footer counts the rows.
  2. Give it a height if 32rem doesn't fit your layout: data-moey-height / height. The header stays put while the rows scroll.
  3. Keep rows similar in height. Moey measures them as you scroll, so mixed heights work, but even rows give the steadiest scrollbar.
  4. Screen readers still hear the real size: the table says how many rows it has and where each drawn row sits (aria-rowcount, aria-rowindex).
  5. On phones the rows still become cards (data-moey-stack), drawn the same way.

Hundreds of thousands of rows, or data that changes all the time? Let your server do the searching and paging instead — see From your server.

From JavaScript

Give it columns and data. Built-in formats — currency, number, percent, date, badge — or your own render. Editable columns change on double-click (or Enter); moey:edit lets you save it, or cancel it.

const products = Moey.datatable('#products', {
  columns: [
    { key: 'name', label: 'Product', render: (v, row) => `<strong>${v}</strong><br><small class="text-muted">${row.sku}</small>` },
    { key: 'category', label: 'Category', filter: 'select' },
    { key: 'price', label: 'Price', format: 'currency', currency: 'USD', editable: true },
    { key: 'stock', label: 'Stock', format: 'number', editable: true },
    { key: 'margin', label: 'Margin', format: 'percent' },
    { key: 'status', label: 'Status', format: 'badge', colors: { Active: 'green', Draft: 'gray', 'Low stock': 'amber' } },
  ],
  data: [{ id: 1, name: 'Moey Mug', sku: 'MUG-01', category: 'Kitchen', price: 14, stock: 120, margin: 62, status: 'Active' }, …],
  pageSize: 10,
  height: '420px',          // scrolls inside, header stays
  stickyFirst: true,        // first column stays while scrolling sideways
  select: true,
  state: 'products',        // remembers sort, page size, columns, density and widths
});

products.root.addEventListener('moey:edit', async (e) => {
  const ok = await save(e.detail.row.id, { [e.detail.key]: e.detail.value });
  if (!ok) e.preventDefault();   // keeps the old value
});

From your server

With data-moey-url (or a fetch function) the server does the work — only one page is loaded at a time, so it scales to millions of rows. Moey asks for ?page=2&size=10&sort=total:desc&q=ana&f_status=Paid and expects { "rows": […], "total": 5000 }. This one pretends: 5,000 orders, each page "loaded" with a short delay.

<div class="datatable" data-moey-url="/api/orders">
  <table class="table">
    <thead>
      <tr>
        <th data-key="id">Order</th>
        <th data-key="customer">Customer</th>
        …
      </tr>
    </thead>
    <tbody></tbody>
  </table>
</div>

// or with your own request:
Moey.datatable('#orders', {
  columns: […],
  fetch: async ({ page, size, sort, q, filters }) => {
    const res = await fetch(`/api/orders?page=${page}&size=${size}&q=${q}`);
    return res.json();           // { rows: [...], total: 5000 }
  },
});

From code & events

const dt = Moey.datatable('#orders');          // the table you already have (or new, with options)

dt.rows · dt.view · dt.selected                // all rows · after search/filter/sort · the selected ones
dt.setData(rows) · dt.add(row) · dt.update(id, { status: 'Paid' }) · dt.remove(id)
dt.search('ana') · dt.sort('total', 'desc') · dt.page(3) · dt.reload()
dt.exportCSV('orders') · dt.clearSelection()

dt.root.addEventListener('moey:bulk', (e) => {        // a bulk button was pressed
  if (e.detail.action === 'delete') dt.remove(e.detail.ids);
});
dt.root.addEventListener('moey:select', (e) => e.detail.rows);
dt.root.addEventListener('moey:change', (e) => e.detail.rows);   // after every search, sort, page…
On a header (th) · column optionWhat it does
data-key · keyThe column's name in data, events and the URL (default: from the label)
data-type="number|date" · typeHow it sorts (numbers and dates are detected anyway). <td data-sort="…"> sorts by another value
data-moey-filter="select" · filter: 'select'A dropdown filter in the toolbar, with the column's values (options: [...] to list them yourself)
data-moey-hidden · hiddenHidden until turned on in the View menu
data-moey-editable · editableDouble-click or Enter to edit
data-moey-sortable="false" · sortable: falseNot sortable (columns without a label never are)
format · render(value, row)currency (+ currency: 'EUR'), number, percent, date, badge (+ colors) · your own HTML
On the table or .datatable · optionWhat it does
data-moey-datatableTurns a plain table into a data table
data-moey-page-size="10" · data-moey-page-sizes="10,25,50,100"Rows per page and the choices (plus "All")
data-moey-select · selectA checkbox column (automatic when the table has a .table-check column)
data-moey-search="false" · data-moey-toolbar="false"No search box · no toolbar at all
data-moey-height="420px" · data-moey-sticky-firstScroll inside with a fixed header · keep the first column in view
detail: (row) => html · <template data-moey-detail>Expandable rows (events moey:detail-open / moey:detail-close)
children: [...] · data-parent · expanded: [ids]Tree rows (events moey:expand / moey:collapse)
groupBy / data-moey-group-by · sum: true / data-moey-sumGrouped rows with counts and totals
data-moey-virtual · virtual: trueAll rows in one scrolling area, drawn only where you look (thousands of rows)
data-moey-stackRows become cards on phones
data-moey-state="orders"Remember sort, page size, columns, density and widths in this browser
data-moey-url · fetch(params)Server-side paging, sorting, search and filters
[data-moey-toolbar] · [data-moey-bulk-action]Your buttons, placed in the toolbar · in the selection bar