Customization & Troubleshooting

Override storage methods, custom database storage, and fixes.

Configuration options

Override any of these methods in your class to customize behavior:

MethodDescription
persistColumnWidthsToDatabase()Customize how column widths are saved to the database
persistColumnWidthsToSession()Customize how column widths are saved to the session
loadColumnWidthsFromDatabase()Customize how column widths are loaded from the database
loadColumnWidthsFromSession()Customize how column widths are loaded from the session
getUserId()Customize how user identification is handled

Example: custom database storage

use Asmit\ResizedColumn\HasResizableColumn;

class ListUsers extends ListRecords
{
    use HasResizableColumn;

    protected function persistColumnWidthsToDatabase(): void
    {
        YourCustomModel::updateOrCreate(
            [
                'user_id' => $this->getUserId(),
                'resource' => $this->getResourceModelFullPath(), // e.g. 'App\Models\User'
            ],
            ['settings' => $this->columnWidths]
        );
    }
}

Troubleshooting

CSS styles not loading

If the resize handles don't display correctly:

  1. Publish the Filament assets:
    Terminal
    php artisan filament:assets
    
  2. Clear your browser cache or hard refresh (Ctrl+F5).