Getting started

Add a new ApiTables-powered page in bolesa-app-ui

This guide walks you through adding a read-only table page from scratch. You need a working backend table first — see Backend getting started or confirm with your team.

Read first

New to ApiTables UI? Spend 10 minutes on Key concepts.

What you will build

A client page that:

  1. Fetches structure from load-table/{tableName}
  2. Renders ReactApiTable with loading state
  3. Automatically queries and displays paginated rows

Prerequisites

RequirementWhy
Backend load-table for your tableSupplies columns, filters, actions
Backend query-table for same tableNameSupplies row data
'use client' page under app/[locale]/...Hooks and Redux require client component
Auth session / tokenSame as other API calls in the app

Confirm the load path with backend — example: /api-table/control-tables/load-table/orders.


Minimal page

'use client';

import { useEffect } from 'react';
import useTableStructure from '@/app/ApiTables/hooks/useTableStructure';
import ReactApiTable from '@/app/ApiTables/ReactApiTable';

export default function OrdersPage() {
  const { getTableStructure, tableStructure, tableStructureLoading } = useTableStructure();

  useEffect(() => {
    getTableStructure({ table: '/api-table/control-tables/load-table/orders' });
  }, []);

  if (tableStructureLoading) {
    return <div>Loading table…</div>;
  }

  return (
    <ReactApiTable
      table={tableStructure}
      tableStructureLoading={tableStructureLoading}
    />
  );
}

Line-by-line

LinePurpose
'use client'Enables hooks in App Router
useTableStructureGET hook — stores response in tableStructure
getTableStructure({ table: '...' })Path to structure endpoint (not query)
tableStructureLoadingPrevent render before structure exists
ReactApiTableWraps provider, controller, grid UI

Paths & imports

Docs use ./ApiTables/. In app code import via @/app/ApiTables/....


Verify in browser

CheckExpected
Network: GET load-tablesuccess: true, columns array
Network: POST query-tableitems with data
UIColumn headers match backend labels
PaginationChanges page → new query POST

If structure fails: fix backend or auth first — see Troubleshooting.


Optional props (when you need more)

<ReactApiTable
  table={tableStructure}
  tableStructureLoading={tableStructureLoading}
  params={{ warehouseId: 'x' }}
  customElement={<MyToolbar />}
/>
PropPurpose
paramsMerged into every query-table body — scope rows to parent context
customElementReact node above table — Custom elements
controllerReplace ApiTablesController for advanced cases
childrenRendered inside ApiTablesProvider before the table

What to learn next

TaskRead
Full client flowArchitecture overview, Data flow
Structure fieldsTable structure
Filters / sortFilters, Sorting
Row or bulk actionsRow actions, Bulk actions
Custom modalAdding a custom control
Refresh from parent formOut-of-scope refresher

Example paths in the app

FeatureStructure path
Categories/api-table/control-tables/load-table/categories
Products/api-table/control-tables/load-table/products

Copy from a working feature in the same app when unsure.


Checklist before PR

  • Loading state while structure fetches
  • Correct load-table path confirmed with backend
  • Table renders columns and rows in dev
  • No hard-coded column definitions in React
  • Page is 'use client'

On this page