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 Koch2d ago
Just the method defintiion is a bit sparse information to help
Matthew
MatthewOP2d ago
I know, 1m pls Still working on it
Matthew
MatthewOP2d ago
This is how the table looks like
No description
Matthew
MatthewOP2d 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
MatthewOP2d ago
Actuallly, here is the whole resource
Matthew
MatthewOP2d ago
If you need more info, pls let me know
Dennis Koch
Dennis Koch2d ago
So the reorder action is missing? 🤔
Matthew
MatthewOP2d ago
Yep
Dennis Koch
Dennis Koch2d ago
I see you use Shield. Do you have the permission to reorder?
Matthew
MatthewOP2d 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
MatthewOP2d ago
yep
No description
Matthew
MatthewOP2d ago
wait do I? 1s
Dennis Koch
Dennis Koch2d ago
Can you remove Shield from that Resource to verify?
Matthew
MatthewOP2d ago
Still nothing And i restarted localhost
Dennis Koch
Dennis Koch2d ago
Can you reproduce this on a fresh install? Otherwise: Maybe policies or additional code on ListUsers?
Matthew
MatthewOP2d 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
MatthewOP2d ago
You can see the arrows at the top, buit I cant drag them
Dennis Koch
Dennis Koch2d 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
MatthewOP2d 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 Koch2d ago
You click the button and the table starts "reorder mode". You can then reorder entries via the arrows at the beginning
Matthew
MatthewOP2d ago
I see now. Then this issue is resolved. Thanks for helping :)
Want results from more Discord servers?
Add your server