Possible, however on a grid field the orderby is used with a column name. Here’re the docs Grid
A grid field when publishing displays based on row order, which is controlled by the content author. Custom ordering isn’t available within the context of the Channel Form, as that would contradict the order set by the content author. @Pedro are you using within a channel form with the {field:...
tag? Or just confirming that ordering by a Grid column works in a Channel Entries tag?
Yes I guess that makes sense, in terms of what the Grid was designed for, when being used in either the Control Panel or a Channel Form.
I’m using the Grid in a Channel Form, so that the user can enter notes about a client (while on the phone for example). Ideally I was hoping to output previous notes in order of the Date column, with latest first, and then allow them to add another note at the top.
I suppose it depends on whether or not the content author needs to create and/or edit multiple rows at once, but if not, you could accomplish the above if instead of a Grid field, you had a Notes
Channel that was reverse related to the Clients
Channel. While on the phone they could view a page for the client that had all of the existing data however it needs to be displayed, and an entry form for the Notes
Channel for a new note. The relationship field could be hidden and you could set the value based on the Client
Channel Entry being viewed.
No, no worries there. You do shift them to a different table by being in a Grid, but you gain flexibility. Are you anticipating hundreds of thousands, or even millions of notes?
You’d need to send a hidden field for the relationship’s field ID, populated with the entry ID of the Client entry. If that doesn’t click, go ahead and output the relationship form field in the context you are looking for, and inspect the HTML to see the form field name and expected values.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.