Issue with reordable table

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
])
->filters([
//
])
->actions([
Impersonate::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->reorderable('name', true);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
])
->filters([
//
])
->actions([
Impersonate::make(),
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->reorderable('name', true);
}
Solution:
You click the button and the table starts "reorder mode". You can then reorder entries via the arrows at the beginning
Jump to solution
22 Replies
Dennis Koch
Dennis Koch2mo ago
Just the method defintiion is a bit sparse information to help
Matthew
MatthewOP2mo ago
I know, 1m pls Still working on it
Matthew
MatthewOP2mo ago
This is how the table looks like
No description
Matthew
MatthewOP2mo ago
In my User Model
protected $fillable = [
'name',
'email',
'password',
'avatar_url',
'role_id',
'has_advanced_time_input',
'favorites',
];
protected $fillable = [
'name',
'email',
'password',
'avatar_url',
'role_id',
'has_advanced_time_input',
'favorites',
];
Matthew
MatthewOP2mo ago
Actuallly, here is the whole resource
Matthew
MatthewOP2mo ago
If you need more info, pls let me know
Dennis Koch
Dennis Koch2mo ago
So the reorder action is missing? 🤔
Matthew
MatthewOP2mo ago
Yep
Dennis Koch
Dennis Koch2mo ago
I see you use Shield. Do you have the permission to reorder?
Matthew
MatthewOP2mo ago
I also checked v4, and its the same (the only difference is that at the header of the table I see that arrows that go ^v), but the rows didnt have any handles to drag
Matthew
MatthewOP2mo ago
yep
No description
Matthew
MatthewOP2mo ago
wait do I? 1s
Dennis Koch
Dennis Koch2mo ago
Can you remove Shield from that Resource to verify?
Matthew
MatthewOP2mo ago
Matthew
MatthewOP2mo ago
Still nothing And i restarted localhost
Dennis Koch
Dennis Koch2mo ago
Can you reproduce this on a fresh install? Otherwise: Maybe policies or additional code on ListUsers?
Matthew
MatthewOP2mo ago
ok, it has to do with permissions I think. I went to the policy, and for debugging purposes, I set reorder to return true. Now I get this
No description
Matthew
MatthewOP2mo ago
You can see the arrows at the top, buit I cant drag them
Dennis Koch
Dennis Koch2mo ago
You don't drag them. It's an action. You click it to enable reorder mode Did you configure ->iconButton() somewhere globally? Not sure whether they are an icon button by default or should have text explaining
Matthew
MatthewOP2mo ago
No I dont think so I think youre right. Its done with
->reorderRecordsTriggerAction(
fn (Action $action, bool $isReordering) => $action
->button()
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
);
->reorderRecordsTriggerAction(
fn (Action $action, bool $isReordering) => $action
->button()
->label($isReordering ? 'Disable reordering' : 'Enable reordering'),
);
So then how does reorderable() work?
Solution
Dennis Koch
Dennis Koch2mo ago
You click the button and the table starts "reorder mode". You can then reorder entries via the arrows at the beginning
Matthew
MatthewOP2mo ago
I see now. Then this issue is resolved. Thanks for helping :)

Did you find this page helpful?