Recipe: MoneyColumn

What / When

Use MoneyColumn when cells are monetary amounts. Prefer it over NumberColumn plus custom JS.

Minimal Example

use Pentiminax\UX\DataTables\Column\MoneyColumn;
use Pentiminax\UX\DataTables\Column\TextColumn;

public function configureColumns(): iterable
{
    yield TextColumn::new('name', 'Product');
    yield MoneyColumn::new('price', 'Price')
        ->currency('EUR')
        ->storedAsCents();
}

protected function mapRow(mixed $item): array
{
    return [
        'name'  => $item->getName(),
        'price' => $item->getPriceInCents(), // e.g. 1999 → €19.99
    ];
}

Pitfalls