Is there a way to add pagination to a repeater component?

So I've got a repeater field, that could potentially get hundreds of entries. Is there a way to do pagination on them, or is that a pipe-dream for the time being?
7 Replies
awcodes
awcodes14mo ago
That is a pipe dream, as far as I’m thinking. You could potentially paginate it, but at that point it’d be better as a relationship manager on a separate model and eloquent query. Just for performance reasons.
cheesegrits
cheesegrits14mo ago
Yeah, at the end of the day it's still an HTML form, even with the Filament Magic. Regardless of the approach, whether it's Livewire or traditional AJAX with JS building the repeats, if you find yourself with a form needing hundreds of repeats that start you thinking about pagination or filtering, you need to find a different approach, move those repeats out of the form.
Sauravisus
SauravisusOP14mo ago
Yeah that makes sense. I've replaced my repeater (and the insanity of the toggle switch) with a Relations Manager. Now I've got a follow-up question: How the heck do I add a delete button to the modal that pops up? For some reason my only option for deleting is via bulk actions. I've got no delete button in the table itself, or in the modal that shows up when clicking an entry.
awcodes
awcodes14mo ago
You should just be able to add a DeleteAction to the ->actions() method on the relationship manager. Just like a normal table. You shouldn't need it in the modal.
Sauravisus
SauravisusOP14mo ago
That's the weird part. This is on my table in the relation manager:
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
]);
->actions([
Tables\Actions\EditAction::make(),
Tables\Actions\DeleteAction::make(),
]);
But they don't show up in the table at all. I do have policies on my resources and whatnot, but I'm on a user with a role that gives access to everything
awcodes
awcodes14mo ago
If you policy is setup correctly it should be showing them.
cheesegrits
cheesegrits14mo ago
Not sure if it's relevant in this case, but by default edit/delete don't show in RM's on View pages.
Want results from more Discord servers?
Add your server