Export fails with TextColumn::make()->numeric() in Filament v4 (The column [x] is not mounted to a table) #234

Closed
opened 2025-09-05 08:49:31 +00:00 by Ali-Maghari · 16 comments
Ali-Maghari commented 2025-09-05 08:49:31 +00:00 (Migrated from github.com)

Hi 👋
I’m running into an issue when trying to export a Filament v4 table that contains a numeric column defined like this:

in my UsersTable.php

TextColumn::make('age')
    ->label(__('dashboard.labels.age'))
    ->suffix(' ' . __('dashboard.labels.year'))
    ->placeholder(__('dashboard.default_values.not_typed_yet'))
    ->numeric()
    ->sortable()
    ->toggleable(isToggledHiddenByDefault: false),

/**
....
*/

ExportBulkAction::make()->exports([
    ExcelExport::make('table')->fromTable()->askForFilename(label: __('dashboard.labels.exported_file_name'))
        ->askForWriterType(label: __('dashboard.labels.exported_file_type')),
]),

And after I try to export I got this error: The column [age] is not mounted to a table.

Steps to reproduce

  1. Create a resource table with a TextColumn using ->numeric().
  2. Add an ExportBulkAction with ExcelExport::make()->fromTable().
  3. Try to export — error occurs.
  4. Removing ->numeric() makes the export work again.
Hi 👋 I’m running into an issue when trying to export a Filament v4 table that contains a numeric column defined like this: in my UsersTable.php ``` TextColumn::make('age') ->label(__('dashboard.labels.age')) ->suffix(' ' . __('dashboard.labels.year')) ->placeholder(__('dashboard.default_values.not_typed_yet')) ->numeric() ->sortable() ->toggleable(isToggledHiddenByDefault: false), /** .... */ ExportBulkAction::make()->exports([ ExcelExport::make('table')->fromTable()->askForFilename(label: __('dashboard.labels.exported_file_name')) ->askForWriterType(label: __('dashboard.labels.exported_file_type')), ]), ``` And after I try to export I got this error: The column [age] is not mounted to a table. **Steps to reproduce** 1. Create a resource table with a TextColumn using ->numeric(). 2. Add an ExportBulkAction with ExcelExport::make()->fromTable(). 3. Try to export — error occurs. 4. Removing ->numeric() makes the export work again.
pxlrbt commented 2025-09-11 07:31:01 +00:00 (Migrated from github.com)

Thanks for reporting. I try to reproduce and fix this in the upcoming weeks.

Thanks for reporting. I try to reproduce and fix this in the upcoming weeks.
Jacobtims commented 2025-09-11 10:30:17 +00:00 (Migrated from github.com)

I have the same problem with ->dateTime() columns

I have the same problem with `->dateTime()` columns
howdu commented 2025-09-12 12:24:32 +00:00 (Migrated from github.com)

Same error with a custom query that adds a raw select that's not in the model.

Same error with a custom query that adds a raw select that's not in the model.
pxlrbt commented 2025-09-12 12:34:20 +00:00 (Migrated from github.com)

@howdu Can you share the code for that?

@howdu Can you share the code for that?
howdu commented 2025-09-12 15:16:41 +00:00 (Migrated from github.com)

@pxlrbt yeah realised it's specifically when using numeric: https://flareapp.io/share/xPQdBgXm

Seems to be erroring when it hits this line and calls getTable on the column.

$locale = $column->evaluate($locale) ?? $column->getTable()->getDefaultNumberLocale() ?? config('app.locale');
@pxlrbt yeah realised it's specifically when using numeric: https://flareapp.io/share/xPQdBgXm Seems to be erroring when it hits this line and calls `getTable` on the column. ```php $locale = $column->evaluate($locale) ?? $column->getTable()->getDefaultNumberLocale() ?? config('app.locale'); ```
jaakon commented 2025-09-15 14:00:41 +00:00 (Migrated from github.com)

I have the exact same issue with ->money()

Works without it.

I have the exact same issue with ->money() Works without it.
ortegavidaljl commented 2025-09-26 09:21:44 +00:00 (Migrated from github.com)

While the problem is being fixed, and for anyone interested, you can use money(), numeric(), etc. in your tables without getting an error if you format the columns in which you have used them in the ExcelExport::make(). NumberFormat has lots of formats you can use. An example:


use pxlrbt\FilamentExcel\Columns\Column;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;

ExcelExport::make()
	->fromTable()
	->askForFilename("operations", "Name")
	->askForWriterType("xlsx", null, "Type of file")
	->withColumns([
		Column::make('amount')
			->format(NumberFormat::FORMAT_CURRENCY_EUR),
		Column::make('discount')
			->format(NumberFormat::FORMAT_PERCENTAGE)
			->getStateUsing(fn ($record) => $record->discount / 100)
	])
While the problem is being fixed, and for anyone interested, you can use money(), numeric(), etc. in your tables without getting an error if you format the columns in which you have used them in the ExcelExport::make(). NumberFormat has lots of formats you can use. An example: ```php use pxlrbt\FilamentExcel\Columns\Column; use PhpOffice\PhpSpreadsheet\Style\NumberFormat; ExcelExport::make() ->fromTable() ->askForFilename("operations", "Name") ->askForWriterType("xlsx", null, "Type of file") ->withColumns([ Column::make('amount') ->format(NumberFormat::FORMAT_CURRENCY_EUR), Column::make('discount') ->format(NumberFormat::FORMAT_PERCENTAGE) ->getStateUsing(fn ($record) => $record->discount / 100) ]) ```
billmn commented 2025-10-10 11:19:02 +00:00 (Migrated from github.com)

Yep, same problem here, with numbers and dates

Yep, same problem here, with numbers and dates
Jacobtims commented 2025-12-02 09:30:18 +00:00 (Migrated from github.com)

@pxlrbt This is again an issues since the v3.2.1 version

@pxlrbt This is again an issues since the v3.2.1 version
pxlrbt commented 2025-12-02 13:20:31 +00:00 (Migrated from github.com)

@Jacobtims Duuh, thanks for reporting. That version was supposed to fix the issue for queues, too. I need to look into this.

@Jacobtims Duuh, thanks for reporting. That version was supposed to fix the issue for queues, too. I need to look into this.
pxlrbt commented 2025-12-07 18:28:17 +00:00 (Migrated from github.com)

@Jacobtims I just tested this with ->numeric() but didn't get an issue. Can you share an example that's not working?

@Jacobtims I just tested this with `->numeric()` but didn't get an issue. Can you share an example that's not working?
Jacobtims commented 2025-12-09 12:44:37 +00:00 (Migrated from github.com)

I have the problem on the following table columns:

TextColumn::make('last_seen_at')
    ->placeholder('-')
    ->sortable()
    ->dateTime()
    ->toggleable(),

TextColumn::make('uplink_remote_port')
    ->label('Uplink port')
    ->numeric()
    ->sortable()
    ->toggleable(),

TextColumn::make('eol_date')
    ->label('EOL date')
    ->dateTime()
    ->sortable()
    ->toggleable(),

The datetime columns are casted in my model class:

protected $casts = [
    'last_seen_at' => 'datetime',
    'eol_date' => 'date',
];
I have the problem on the following table columns: ```php TextColumn::make('last_seen_at') ->placeholder('-') ->sortable() ->dateTime() ->toggleable(), TextColumn::make('uplink_remote_port') ->label('Uplink port') ->numeric() ->sortable() ->toggleable(), TextColumn::make('eol_date') ->label('EOL date') ->dateTime() ->sortable() ->toggleable(), ``` The datetime columns are casted in my model class: ```php protected $casts = [ 'last_seen_at' => 'datetime', 'eol_date' => 'date', ]; ```
KasparAas commented 2026-01-30 17:10:05 +00:00 (Migrated from github.com)

@Jacobtims Hope this helps - I had the same issue and I manage to fix date columns ->dateTime() by adding a default date time format like this:
->dateTime('d.m.Y H:i')

@Jacobtims Hope this helps - I had the same issue and I manage to fix date columns **->dateTime()** by adding a default date time format like this: **->dateTime('d.m.Y H:i')**
pxlrbt commented 2026-01-30 19:19:41 +00:00 (Migrated from github.com)

@KasparAas That makes sense. Maybe the easiest fix would be to provide a default format for the export.

@KasparAas That makes sense. Maybe the easiest fix would be to provide a default format for the export.
pxlrbt commented 2026-02-17 16:13:12 +00:00 (Migrated from github.com)

I made some progress on this one. Just need to figure out how to fix the queued exports. 😵‍💫

I made some progress on this one. Just need to figure out how to fix the queued exports. 😵‍💫
pxlrbt commented 2026-02-17 17:06:35 +00:00 (Migrated from github.com)

Hey everybody, I hoped this issue is fixed with the latest version. Please try and report any issues. Thanks!

Hey everybody, I hoped this issue is fixed with the latest version. Please try and report any issues. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pxlrbt/filament-excel#234
No description provided.