Reordable not enabling on relationship repeater

I'm building a nested relationship and i'm having a issue where the reordable settings are completely ignored if i set a relationship on the repeater field. Each model involved is using the spatie/eloquent-sortable package. Right now i have Page model which has a series of ContentFields attached to it through a hasMany relationship
public function blocks(): HasMany
{
return $this->hasMany(Contentfield::class)->orderBy('order_column', 'asc');
}
public function blocks(): HasMany
{
return $this->hasMany(Contentfield::class)->orderBy('order_column', 'asc');
}
this works perfectly fine and i can reorder the elements with drag and drop and buttons. I have also setup the blocks to have a HasMany relationship to ContentFieldPromo model which is a pivot from which i can attach a Promo model to it so i can make the repeater field compatible indirectly with a belongsToMany Relationship,
public function block_promos(): HasMany
{
return $this->hasMany(ContentfieldPromo::class)
->with(['promo'])
->orderBy('order_column');
}


public function promos(): BelongsToMany
{
return $this->belongsToMany(Promo::class)->withPivot(['order_column']);
}
public function block_promos(): HasMany
{
return $this->hasMany(ContentfieldPromo::class)
->with(['promo'])
->orderBy('order_column');
}


public function promos(): BelongsToMany
{
return $this->belongsToMany(Promo::class)->withPivot(['order_column']);
}
this works as expected in every other part of the application where i setup something similar however in this specific case filament is ignoring the reordable settings on the repeater
Repeater::make('promos')
->label('Promos')
->reorderable(true)
->reorderableWithDragAndDrop()
->reorderableWithButtons()
->orderColumn('order_column')
->relationship('block_promos')
->schema([
RecordFinder::make('promo_id')
->label('Promo')
->relationship('promo')
->openModalActionModalWidth(MaxWidth::Full)
->slideOver()
->badge()
])
->grid(3)
Repeater::make('promos')
->label('Promos')
->reorderable(true)
->reorderableWithDragAndDrop()
->reorderableWithButtons()
->orderColumn('order_column')
->relationship('block_promos')
->schema([
RecordFinder::make('promo_id')
->label('Promo')
->relationship('promo')
->openModalActionModalWidth(MaxWidth::Full)
->slideOver()
->badge()
])
->grid(3)
I can confirm the field works properly since i can add and remove items but i can't reorder. Disabling the relationship makes the field enable reordering.
No description
6 Replies
Aivirth
AivirthOP2w ago
Anyone ? I have no idea if it's an issue related to something wrong i did or it's a limitation of filament itself
Aivirth
AivirthOP2w ago
As a clutch I tried to replace the native Repeater field with the TableRepeater from Awcodes and the reorder is working properly This leads me to believe there's a bug with the Repeater field for this specific edge case.
No description
No description
toeknee
toeknee2w ago
I think it's being your using a grid
Aivirth
AivirthOP2w ago
I did try to remove the grid but the result was still the same
toeknee
toeknee2w ago
Strange could be a sub nesting issue. Can you create a reproduction repo and submit a GH Issue?
Aivirth
AivirthOP2w ago
Situation is a bit hectic since we are nearing release, I will try as soon as I am able.

Did you find this page helpful?