Introducing Grid, New in ExpressionEngine 2.7

15 comments

A long-requested feature is here. ExpressionEngine 2.7 is coming soon and includes a new fieldtype that allows authors to use grouped fieldtypes to publish any number of rows of related content within an entry. We’re calling it Grid, and it’s great for photo galleries, addresses, product details, baseball statistics and more.

A Grid field can be configured with multiple columns, each capturing data with any of ExpressionEngine’s existing fieldtypes, including any Grid-compatible third-party fieldtypes. From there, each channel entry can have a dynamic number of rows in the Grid field to suit the needs of that particular entry.

Let’s take a look at some real-world use cases for Grid.

Frequently, an author would like to attach photos to accompany a channel entry. The number of photos needed varies by entry, and the author would like to add a description and a photo credit. So we will create a Grid field called “gallery” and group a file field, text input and a rich text editor to capture and group this information.

To display our images in a template, we’ll use a tag pair along with prefixed variables so it’s easy to see where a variable is coming from:

{gallery}
    
<figure>
        <
img src="{gallery:image}">
        <
figcaption>Photo by {gallery:credit}</figcaption>
    </
figure>
    
{gallery:description}
{
/gallery} 

Another great use for Grid is numeric data. Let’s capture some baseball player statistics from a single game in a field called “stats”. We will use a Relationships field to relate the stats to a single player, then use text fields to capture the stats which can easily be tabbed across to quickly enter information:

Displaying this information is easy. Since this is tabular data, we’ll tell Grid to make a table for us:

<h1>Player Stats</h1>
{stats:table} 

And since the data is all numeric, we can ask Grid to give us simple statistics:

Most hits{stats:highest column="hits"}
Average RBI
{stats:average column="rbi"}
Total runs scored
{stats:sum column="runs"}
Players with runs
{stats:total_rows search:runs=">0"

As illustrated, the new Grid field can lend its flexibility to a wide range of needs. This feature and much more are coming soon in ExpressionEngine 2.7.

Comments & Feedback

  1. will we be able to use other fieldtypes inside Grid?

    Picture of Steven Grant

    Steven Grant

  2. will we be able to use other fieldtypes inside Grid?

    Yes, third parties will be able to make their fieldtypes compatible for use in Grid, some have already gotten started during the developer preview. It was a goal in development to make porting an existing fieldtype over to Grid as easy as we could, and there is clear documentation on how to do so that will be public after the release.

    Picture of Kevin Cupp

    Kevin Cupp

  3. Wow wow wow

    Picture of Willem de Boer

    Willem de Boer

  4. Is this essentially a replacement of Matrix?

    Picture of Fat Free Interactive

    Fat Free Interactive

  5. This has been missing for a while so thanks for adding this. Hopefully the bugs with the RTE will be sorted soon so we can actually use your example!

    Picture of Clive Portman

    Clive Portman

  6. Awesome! Looking forward to it!

    Picture of Giraffentoast

    Giraffentoast

  7. How soon is soon?

    Picture of Okapi Creative

    Okapi Creative

  8. Does it support muliple files/images upload? Thanks

    Picture of Fedor

    Fedor

  9. Hi @Fedor,

    It does if you use FIle as a celltype and add additional rows to your Grid. Kevin’s first example in the post highlights one approach you might take with that ability.

    Picture of Dan Decker

    Dan Decker

  10. Hey Kevin / Dan,
    Would it also be possible to grab data from row X to use elsewhere? For example, for a news article I would have a Matrix table to store all images and then on a news index page I would grab the first row/image as a leader for the news article.

    Perhaps we could do something like {gallery:image:1}?

    Picture of energycell

    energycell

  11. Is Grid going to be fully SafeCracker aware/compatible? Maybe some work can be done with Safecracker File to give it a bit more love - like giving the filetype some inline upload status bar like the old nGen File Field had when you uploaded. Nothing seems to provide this anymore in a simple file-based fieldtype.

    Picture of ipixel (Australia)

    ipixel (Australia)

  12. @energycell: Yes, for that you’d use the limit parameter, for example: {gallery limit=“1”}{gallery:image}{/gallery}.

    @ipixel: Yes Grid will work in SafeCracker forms.

    Picture of Kevin Cupp

    Kevin Cupp

  13. Awesome, can’t wait to see all that you guys are doing with 2.7

    Picture of Ian Callender

    Ian Callender

  14. Very nice. As I’m often as first to speak out about anything I don’t like, I thought I should give some praise back. I fully support the defence of your product, and in replacing the P&T add-ons with native components.

    Those who have criticised this should understand that while P&T sell EE add-ons, they have direct access to market/expose their alternative product to EE customers. What EL are doing is necessary and smart.

    Picture of Calan

    Calan

  15. Can wait to get started with this! Just PLEASE make sure you have it tested like crazy so we are not all disappointed with a buggy release (again).

    Picture of Jeremy S.

    Jeremy S.

You must be logged in to comment on this blog post