Data Table

Filter payments by email, sort the results, and select rows across pages.

This example uses simple-datatables

Simple-datatables handles sorting, filtering, and pagination in the browser. Basecoat supplies the table and controls. If your server handles those operations, use Table on its own.

Payments
Status Amount Actions
success ken99@example.com $316.00
success Abe45@example.com $242.00
processing Monserrat44@example.com $837.00
success Silas22@example.com $874.00
failed carmella@example.com $721.00
0 of 5 row(s) selected.
Page 1 of 2

Usage

Load Basecoat and simple-datatables

Include the Basecoat stylesheet and JavaScript bundle on your page. Add this script to the page head for sorting, filtering, and pagination.

<script src="https://cdn.jsdelivr.net/npm/simple-datatables@10.3.0/dist/umd/simple-datatables.js" defer></script>

Copy the payments table

Copy the table and its controls from the Code tab into your page body. Put the accompanying style rules in your stylesheet. For each payment, use the same ID on the row and as its checkbox value.

Connect the controls

Download payments.js and save it beside your HTML file. This is the script the preview uses to connect the controls to the table and keep rows selected across pages. Add this at the end of the page body:

<script type="module">
  import { mountPayments } from "./payments.js";

  mountPayments(document.getElementById("payments-demo"), simpleDatatables.DataTable);
</script>

Examples

RTL

Basecoat uses logical alignment. Email addresses and amounts retain their content, while the toolbar, table, and footer follow the container direction.

المدفوعات
الحالة المبلغ الإجراءات
ناجح ken99@example.com $316.00
ناجح Abe45@example.com $242.00
قيد المعالجة Monserrat44@example.com $837.00
ناجح Silas22@example.com $874.00
فشل carmella@example.com $721.00
تم تحديد 0 من 5 صفوف.
الصفحة 1 من 2