Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: {total_rows} always renders as 1 for a simple_grid field inside a regular Grid field

Status Resolved
Add-on / Version Simple Grids & Tables 1.0.2
Severity
EE Version 4.3.4

Jennifer Martin

Sep 24, 2018

Description: {total_rows} seems to always render just as “1” when used inside a simple_grid tag pair where the simple_grid field is used inside a regular Grid field.

Try this code:

{grid_field}
{grid_field:simple_grid_field}
{count} of {total_rows}—{simple_grid_data_col_a} {simple_grid_data_col_b}
{/grid_field:simple_grid_field}
{/grid_field}

Let me know if I need to setup server access, but I think you’ll be able to replicate.

#1

BoldMinded (Brian)

Did you try adding a prefix? e.g.

{grid_field:simple_grid_field prefix="foo:"} {foo:total_rows} {/grid_field:simple_grid_field}
#2

BoldMinded (Brian)

I assume the value of total_rows is the value of how many Grid rows there are, not Simple Grid rows? Have you tried the prefix option yet?

#3

Jennifer Martin

Sorry for the delay - our company account email (design@) is different to mine and I don’t get an email with a notification of the replies despite adding myself to the ticket… so I tend to forget to check back. But I did try it with a prefix and that still doesn’t work either:

{menu_items:pricing prefix=”foo:”} {foo:count} of {foo:total_rows} - {foo:time}{if foo:cost} / ${foo:cost}{/if} {/menu_items:pricing}

With the above {foo:total_rows} still always renders as 1, but {foo:count} does increment correctly.

#4

Jennifer Martin

Sorry I should also say that in my case, I have multiple Grid rows too, so {total_rows} does not appear to be rendering the number of Grid rows… but that must be where the conflict lies because total_rows is a valid variable inside a grid.

Thanks, Justin

#5

BoldMinded (Brian)

Thanks for clarifying. New build in the next post should fix it. Here is the template code I used to test:

{exp:channel:entries entry_id="6"}
{grid}
    total_rows: {grid:total_rows}
    <table>
    {grid:simple_grid}
        <tr switch="{switch='odd|even'}">
            <td>{text}: {total_rows}</td>
        </tr>
    {/grid:simple_grid}
    </table>
{/grid}
{/exp:channel:entries}
#6

BoldMinded (Brian)

Comment has been marked private.

#7

Jennifer Martin

Thanks Brian - confirmed that fixes it!

Login to reply