With the current grid you can only add rows of data. What if you need authors to be able to specify additional variables for the grid data, for instance to control the presentation?
Example:
I want to allow authors to specify how the list is styled from a predefined list, such as “normal” or “highlighted” (i.e. so I can use a field to add a custom CSS class value)
At the moment there’s no easy/logical way to do that.
The idea:
{grid}
{if grid_count == 1}
<ul class="{grid_one_time_field}">
{/if}
<li>{grid:item}</li>
{if grid:count == grid:total_results}
</ul>
{/if}
{/grid}
I ran into this a while back too. It would be handy to have the ability to assign non-looping variables (class & ID maybe) to grid layouts that could be “set” within the grid field part of the CP so that publishers know it’s associated with that grid.
{grid}
{grid:id} {grid:class}
{/grid}
I’m envisioning a kind of HTML button row at the top of the grid field in the CP, … or a menu maybe.. not a text area.
How would you see this working in the CP Rob?
Hey Kurt!
When you create a grid they would be two types of fields, repeating and non-repeating:
Repeating field is as it is now, add your column fields, job done.
Non-repeating fields you could add as many of as needed, but they’d be single field, single use, nearly any field type, there might have to be a few limitations as to what field types are available but certainly generic fields like TEXT, RTE, SELECT, RADIO, CHECKBOX should be do-able..
On the publish page I’d see it as the non-repeating fields coming first above the actual repeating grid so you could set values for the whole grid.
Possible examples:
… possible dozens more!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.