GraphQL

Below is an example of what a GraphQL query looks like with a Simple Grid or Simple Table. Simple Grid is very straight forward, just set the field name, followed by the columns you want returned in the query in brackets.

Due to the strict nature of GraphQL, Simple Table is just as straight forward, but slightly more tedius. You need to explicitly define every column to return. The tedius part is Simple Table fields can have new columns added dynamically in the entry publish form. If you set a limit of 15 columns, and only 4 of them are used in entry A, and 12 are used in entry B, then you need to define col_1, col_2, col_3, all the way to col_15 in the query, otherwise you may not get all the values returned for each column in each entry that uses the field.

{
  exp_channel_entries(channel: "grids", entry_id: "1") {
    data {
      entry_id
      title
      my_simple_grid_field {
        rte_field
        duration
        color
      }
      my_simple_table_field {
        heading_row
        col_1
        col_2
        col_3
        col_4
      }
    }
  }
}

Last updated