Using repeater to fill an indexed array format
I have a text column which contains a simple indexed array list of names:
and I'm using a
collection
cast on the model to serialize and deserialize it.
but when I use the Repeater
component it doesn't load the data of existing models, and it only shows empty fields.
if I try to create new items, the output looks like this:
10 Replies
I think you need the
array
cast instead, for the RepeaterHave tried that as well, there's no difference
it just returnes an associative array
Does the Repeater field save and load correctly with the
array
cast?it just does the same as collection:
same with collection, i don't get an error. but i don't get the expected format.
Yes, I think that's normal. So the issue is related to the TextColumn?
(The Repeater can contain many fields, that's why it saves the items as associative arrays)
I get that, but i thought maybe there is an option to tell it i don't have many fields, just give me a simple list without repeating the same key for all items
Makes sense. But if I understand correctly, your issue is more related to how you get the data to be displayed, right? Or does it really matter to you how the data is stored?
i can make this work, but it's just tedious to reference it like
option['name']
everywhere instead of just a beautiful option
isn't it?Maybe a model attribute?
thanks, that's what i ended up doing