> ## Documentation Index
> Fetch the complete documentation index at: https://docs.advancedtables.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reorderable Columns

> Enhance Filament's toggleable columns dropdown with drag-and-drop column reordering and persistence across views.

Advanced Tables enhances Filament's [toggleable columns](https://filamentphp.com/docs/3.x/tables/columns/getting-started#toggling-column-visibility) dropdown with powerful column reordering. Now you and your users can move hide, show, and move columns to create a totally custom view. Best of all, when a user creates a new User View, their new column order is saved as well.

> Note: When using a table with a [column layout](https://filamentphp.com/docs/3.x/tables/layout), the columns dropdown will not show the reorder button since columns cannot be reordered in this type of layout.

## Reordering columns

To reorder columns:

1. Click the toggle column button in the table toolbar to open the column dropdown.
2. Click the `up/down arrow` button to enable reordering
3. Drag and drop your columns in the order you prefer.

> Note: At least one column in your table must be `toggleable()` for Filament to display the toggle column button.

## Reorderable Columns configurations

Advanced Tables offers multiple ways to customize Reorderable Columns. Unless specified otherwise, these options can be configured directly on the `AdvancedTablesPlugin` object inside your `PanelProvider`.

### Disabling column reordering

Advanced Tables enables column reordering by default. You may disable this and use Filament's native column toggling UI by passing `false` to the `reorderableColumnsEnabled()` method:

```php theme={null}
AdvancedTablesPlugin::make()
    ->reorderableColumnsEnabled(false)
```

You may also disable Reorderable Columns per resource by overriding the `canReorderColumns()` method in the class where you have added the AdvancedTables trait:

```php theme={null}
public function canReorderColumns(): bool
{
    return false;
}
```

### Always displaying the hidden label

By default, the enhanced toggle column dropdown will only display the `Hidden` label when there are hidden columns. To always display the hidden label you may use the `reorderableColumnsAlwaysDisplayHiddenLabel()` method:

```php theme={null}
AdvancedTablesPlugin::make()
    ->reorderableColumnsAlwaysDisplayHiddenLabel()
```

### Display the toggle column dropdown as two columns

You may show the toggle column dropdown as two columns by using the `columnToggleFormColumns()` method on your table:

```php theme={null}
public static function table(Table $table): Table
{
    return $table
        ->columns([
            ...
        ])
        ->columnToggleFormColumns(2)
```

### Configuring the icons

You may change any of the icons used for Reorderable Columns by using the following methods:

```php theme={null}
AdvancedTablesPlugin::make()
    ->reorderIcon('heroicon-m-arrows-up-down')
    ->checkMarkIcon('heroicon-m-check')
    ->dragHandleIcon('heroicon-o-bars-2')
    ->visibleIcon('heroicon-s-eye')
    ->hiddenIcon('heroicon-o-eye-slash')
```

To remove any of the icon, don't pass anything to the the respective method: `->hiddenIcon()`
