GoFilament
You're reading the docs for v1.34.0, an older release. Go to v1.40.1 (latest).

Docs v1.34.0 Guide

Table Builder Features

GoFilament’s Table Builder (pkg/tables) provides a high-performance, type-safe data grid with server-side pagination, sorting, filtering, bulk actions, and advanced client interactivity:

table := tables.New[*Customer]().
    Toggleable(true).               // Enable Column Show/Hide dropdown
    Reorderable("sort_order").      // Enable Drag-and-Drop row reordering
    Columns(
        tables.TextColumn[*Customer]("id").Sortable(),
        tables.TextColumn[*Customer]("name").Editable(true).Sortable(), // Inline editable on click
        tables.SelectColumn[*Customer]("status").Options(map[string]string{
            "active":   "Active",
            "inactive": "Inactive",
            "pending":  "Pending Review",
        }), // Inline select dropdown
        tables.ToggleColumn[*Customer]("is_verified"),                 // Interactive toggle switch
        tables.TextColumn[*Customer]("email").Copyable(),
        tables.TextColumn[*Customer]("notes").ToggledHiddenByDefault(true), // Hidden until toggled
    ).
    Filters(
        tables.SelectFilter("status").Options(map[string]string{
            "active": "Active Only",
        }),
    ).
    Actions(
        tables.EditAction[*Customer](),
        tables.DeleteAction[*Customer](),
    ).
    BulkActions(
        tables.DeleteBulkAction(),
        tables.ExportBulkAction(),
    )

🗑️ Soft Deletes & Trash Recovery Bin (res.SoftDeletes())#

Protect your application from accidental data loss with full lifecycle soft-delete support and Trash Recovery Bin:

res := filament.NewResource[*Document]("documents").
    SoftDeletes(true).                           // Enables soft-delete awareness and trash scoping
    OnRestore(func(ctx *filament.Context, id string) error {
        return db.RestoreDocument(ctx, id)
    }).
    OnForceDelete(func(ctx *filament.Context, id string) error {
        return db.PermanentlyDeleteDocument(ctx, id)
    })
  • Automatic Trashed Filter: Injects a 3-state scope filter (Without Trashed (default active), With Trashed, and Only Trashed (trash bin view)) into the table toolbar.
  • Dynamic Row Action Swapping: Active records show standard Edit and Delete actions, while trashed records automatically display Restore (⟲) and Force Delete (🗑) actions with safety confirmation modals.
  • Visual Highlight: Trashed records automatically display [Trashed] badges and muted row styling (.table-row-trashed).
  • Bulk Operations: Seamlessly restore or purge batches of records with tables.RestoreBulkAction() and tables.ForceDeleteBulkAction().
  • Activity Log Audit Trail: Intercepts restore and force delete operations, recording restored and force_deleted events in the audit trail.
  • REST API Support: Native endpoints at /admin/api/resources/{slug}/restore and /admin/api/resources/{slug}/force-delete.

⚡ Advanced Table Capabilities:#

  • ✏️ Inline Cell Editing: Edit values directly in the table row without opening edit modals or full pages:
    • TextInputColumn[T](name): Direct inline text edits synced on blur or Enter.
    • SelectColumn[T](name): Immediate status/role updates via interactive dropdown.
    • ToggleColumn[T](name): Instant visual switch animation persisting state asynchronously.
    • TextColumn[T](name).Editable(true): Click-to-edit inline field with Esc revert and Enter save.
    • Automatic backend integration: Routes POST /admin/{resource}/cell and POST/PATCH /admin/api/resources/{slug}/:id/cell, triggering r.OnCellUpdate(func(ctx, id, column, value) error) or model updates.
  • 👁️ Dynamic Column Toggling (Show/Hide): Operators can customize which columns are visible via a “Columns” dropdown menu. Preferences are automatically persisted to browser localStorage across page visits.
  • ↕️ Drag-and-Drop Row Reordering: Reorder records with grip handles (⋮⋮). Dragging a row dispatches an asynchronous update to POST /admin/{resource}/reorder and POST /admin/api/resources/{slug}/reorder, calling r.OnReorder(func(ctx, orderedIDs) error).
  • 🚀 Server-Side Sorting & Filtering: Multi-column sorting (↑, ↓), search bars, SelectFilter, and TernaryFilter (soft-deletes).
  • 📅 Range filters: tables.DateRangeFilter("created_at") and tables.NumberRangeFilter("amount") give “from / to” inputs (web) and a range dialog (Flutter). Your list handler receives filters["created_at"] = "2026-01-01,2026-01-31" (either side may be empty). Turn it into SQL with f.Condition(value) + tables.BuildAdvancedSearchSQLFor (the end date is inclusive), or check in-memory records with f.Matches(value, v).
  • 🧮 Summaries & grouping: tables.TextColumn[T]("amount").Summarize(tables.Sum, tables.Avg) shows aggregates under the column for the page and per group (tables.Sum, Avg, Count, Min, Max). res.SummariesUsing(func(ctx, search, filters) (tables.Summaries, error)) adds an “All results” row computed by your database (and summaries in the API). t.Groups("status") / t.DefaultGroup("status") let users group rows with a header and subtotal per group; while grouped, the list is sorted by the group column. Web and Flutter.
  • 🔒 Edit conflicts: res.Versioned(func(r *Order) string { return r.UpdatedAt.String() }) stops one admin from silently overwriting another’s save. Edit forms (web and Flutter) carry the version they were opened with; a stale save gets 409 and the editor offers Reload or Overwrite. For a race-free write, use filament.ExpectedVersion(ctx) in your OnUpdate (UPDATE ... WHERE id = ? AND updated_at = ?). API clients that send no _version are not checked.
  • 📦 Streaming Bulk & Header Actions: In-line View/Edit/Delete actions, multi-record delete, and streaming data export (CSV, TSV, JSON).

Generated from README.md at v1.34.0 · released Nov 17, 2026