Skip to content

Commit d46b581

Browse files
authored
Merge pull request #1165 from ExpressionEngine/fix/grid-fluid-documentation
Correct Grid and Fluid template documentation a bit
2 parents 9eac2ae + f07a4de commit d46b581

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

docs/channels/entries.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,8 +1286,8 @@ For instance, if you have a Relationship field with an `{if no_results}` block,
12861286
{/exp:channel:entries}
12871287
```
12881288

1289-
NOTE: **Note:** Grid, File Grid, and Member fields do not have a `{if no_results}` conditional. Use [:total_rows](/fieldtypes/grid.md#total_rows-1).
1290-
Fluid fields do not have a `{if no_results}` conditional. Use [:total_fields](/fieldtypes/fluid.md#total_fields)
1289+
NOTE: **Note:** To test whether a Grid or File Grid field is empty, use [:total_rows](fieldtypes/grid.md#total_rows-1). For a Members field, use [:total_rows](fieldtypes/member.md#total_rows). For a Fluid field, use [:total_fields](fieldtypes/fluid.md#total_fields).
1290+
12911291
```
12921292
{exp:channel:entries channel="blog"}
12931293
{if my_grid_field:total_rows == 0} Grid is empty {/if}
@@ -1296,7 +1296,9 @@ Fluid fields do not have a `{if no_results}` conditional. Use [:total_fields](/f
12961296
{/my_grid_field}
12971297
{if my_fluid_field:total_fields == 0} Fluid field is empty {/if}
12981298
{my_fluid_field}
1299-
{my_grid_field:text}
1299+
{my_fluid_field:text}
1300+
{content}
1301+
{/my_fluid_field:text}
13001302
{/my_fluid_field}
13011303
{if no_results} No entries {/if}
13021304
{/exp:channel:entries}

docs/fieldtypes/grid.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Make a copy of the field by clicking the "copy" icon -- two superimposed squares
6868

6969
Just as with other field types, you can specify whether a grid field is required or not. This applies to every row in the grid.
7070

71-
For some fieldtypes, you can choose whether its content should be included in search. The overall grid field must also be set to Include in Search, or else this setting will not have any effect. If you change the search inclusion status of an existing grid Field -- or make other changes to the field settings -- you will need to [re-index your content](control-panel/utilities/data-operations.md#search-reindex)
71+
For some fieldtypes, you can choose whether its content should be included in search. The overall grid field must also be set to Include in Search, or else this setting will not have any effect. If you change the search inclusion status of an existing grid field or column, you will need to [re-index your content](control-panel/utilities/data-operations.md#search-reindex).
7272

7373
You may set a minimum width for each grid field. When the grid is set to display horizontally, any grid field with a minimum width will have that width applied to it; fields without any minimum width will be given the remaining space.
7474

@@ -78,7 +78,7 @@ You may set a minimum width for each grid field. When the grid is set to display
7878
Contents of a Grid Field are accessed via prefixed variables representing each column, surrounded by a variable pair. For example, if you have a grid field called `awards` with `name`, `details`, and `year_awarded` fields, your template code may look like this:
7979

8080
{awards}
81-
<h3>{awards:name} - {awards:year_awarded}<h3>
81+
<h3>{awards:name} - {awards:year_awarded}</h3>
8282
{awards:details}
8383
{/awards}
8484

@@ -270,10 +270,12 @@ Outputs the data in the grid field as a table. All parameters available to the p
270270

271271
{grid_field:total_rows search:height=">55"}
272272

273-
When outside of a grid field tag pair, this modifier can be used to get the total number of rows in a field given a specific criteria. Useful for determining if there are any grid rows at all: `{if grid_field:total_rows == 0} Grid is empty {/if}`. Note that `no_results` is not a valid conditional for the Grid field. Also note that you need to wrap the tag in quotes and curly braces if you are using any parameters:
273+
When outside of a grid field tag pair, this modifier can be used to get the total number of rows in a field given a specific criteria. Useful for determining if there are any grid rows at all: `{if grid_field:total_rows == 0} Grid is empty {/if}`. When using parameters, wrap the tag in curly braces. Quotes around the numeric result are optional:
274274

275275
{if "{grid_field:total_rows search:height='>55'}" == 0} No rows with tall things {/if}
276276

277+
NOTE: **Note:** Grid can process `{if no_results}` when existing rows are excluded by parameters such as `offset`, but a field with no stored rows returns without processing it. Use `:total_rows` to check whether the field has any rows. When nested in `{exp:channel:entries}`, put the Channel Entries `{if no_results}` block before the Grid tag pair.
278+
277279
### `:next_row`
278280

279281
{grid_field:next_row row_id="{segment_3}"}

0 commit comments

Comments
 (0)