FileUpload display order change
Hello, when I use FileUpload with multiple images after it saves and I refresh the page it is showing the images in the reverse order of the ones that came in the array. Does anyone know how to resolve this? Thanks.
9 Replies
Hi @joaonivaldo, have you tried
->enableReordering()
on the FileUpload field?It's already enabled. The problem is in the initial load that it comes in reverse order and I really need to keep the order that the client chooses for the images.
Maybe
->appendFiles()
Thank you very much. It worked really well. I thought I was going to have to use another component for this. I just didn't find anything in the documentation either in Filament or in FilePond about this appendFiles method. Could you point me where I can see more about this method? It was worth it.
Are you using a relationship for them?
I just found it by looking around in the source code. Not a super good answer, I know, but at least there's that 🙂
I think it’s down to the fact that the array is assigned uuids as the keys for the array. Meaning that preserving the order could be difficult to do from that.
Or I could be thinking of a different component.
Just thinking about it from the curator standpoint where I had to compensate for relationships since they’re not orderable by default.
Sounds like a repeater/builder indeed, but I haven't looked at the data structure for the multiple file upload, you might be right
Relationships have to have an orderable column on a pivot table to make them work.
And the relationship has to be defined to compensate it.