Edit Model and related models on single screen #1754
Replies: 3 comments
-
Bump I want something similar as @snavebelac, being:
|
Beta Was this translation helpful? Give feedback.
-
I am trying to achieve the same thing as @EeKay and @snavebelac |
Beta Was this translation helpful? Give feedback.
-
This seems to be a weak area of Orchid. I haven't found a good solution yet, but here are some things to look at: The Matrix field is basically an editable HTML table. You can define the columns in the table, and then the user can add, edit, and remove rows. I haven't been able to make this work for relations, though. First of all, I can't figure out how to set the initial contents of the matrix – unlike other field types, it doesn't seem to detect this automatically. Secondly, the rows don't seem to include a primary key – so I don't understand how my handler would be able to determine which rows are new items (that need to be inserted), and which are existing items (that need to be updated). It seems to expect you to store the entire contents of the Matrix as a single value – e.g., in a JSON column. I tried to find a way to include a hidden ID field, but I had no luck. orchid-repeater-field seems to be closer to what I need (and tabuna often recommends this package when people ask for this functionality). However, it doesn't support PHP 8.x yet. And I'm wary of hitching my project to such a little-used repo. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm new to Orchid.
I'm trying to figure out how to edit a a model and its relation on a single screen. I have Users working and can edit a user as required. My users are related to children and I would like to list and allow editing of children from a single screen. E.g. for any given user I would like to add a new child and edit their existing data. I will never want to be able to edit children separately from their parents.
Is this possible?
I have added
Relation
into my layout as follows...But this only allows me to add existing children. How can I create new ones from this and edit child data directly?
I have loaded the
Children
in the query method as follows...But I can't figure out how to use that data in the layout method as children is a collection.
Thanks in advance for any help.
Beta Was this translation helpful? Give feedback.
All reactions