How to Add Groupings to a Grid

Scenario

Grids are an excellent way to display information in your Knack apps. Especially, since they offer many features to further organize your data for easy understanding.

For example, let's say you want to create a grid that quickly shows which donors are making the most donations. So you start with a grid that shows all donations:

 

 

It's not a bad start, but it's not easy to tell who your best donors are. That's where a feature like grouping can make all the difference.

Grouping allows you to group records by a common value in selected grid columns. Here’s what your grid will look like when it's grouping the donations by donor:

 

 

With a header row for each donor and their donations listed below them, you can see who’s in the giving spirit at a glance.

Plus, since the "Amount" column was already totaled using a row summary, the grouping now shows the total per donor. Though there’s still a complete total for all donors at the bottom of the grid:

 

Requirements

If this is your first time creating an app, you'll need to know some basics about adding tables, fields, pages, and views. You can start by watching our "Introducing Knack" video tour and then working through the articles in our Builder Basics section. Other good resources can be found in our About Your Database and Working With Pages sections of the knowledge base.

Steps

Here's a quick video walkthrough of the steps below:

<iframe class="tscplayer_inline smart-player-embed-container-iframe embeddedObject" style="overflow: hidden;" src="https://www.screencast.com/users/odalis1280/folders/KB%20Videos/media/9118aeca-6882-49ae-af46-2e8baedc72bf/embed" name="tsc_player" scrolling="no" allowfullscreen="" width="800" height="400" frameborder="0"></iframe>
 
  • Select the Page with the Grid

In the Pages section of the Builder, select the page that holds the grid you want to add grouping to.


  • Open the Grid Editor

    Click on the grid in the Builder or click on the pencil icon for the grid on that page to open the editor.

 

  • Edit the Field/Column

Hover over the column you want to add grouping to and click the pencil icon to edit that column.


  • Enable Grouping

Enable the grouping option by checking the “Grouping” box:

 

 

Once grouped, the field will form a column across the grid:

 

 

Groupings on views do not currently export.