0

Am I using no_results properly? Even when the grid doesn't have any data, I cannot get the "N/A" to output in the templates:

{store_telephone_data limit="1" offset="0"}
    {if store_telephone_data:no_results}
        <td>N/A</td>
        <td>N/A</td>
    {/if}
    {if store_telephone_data:count == 1}
        <td>
            {store_telephone_data:store_telephone_number}
        </td>
        <td>
            {store_telephone_data:store_telephone_type limit="1" offset="0"}
                {store_telephone_data:store_telephone_type:title}
            {/store_telephone_data:store_telephone_type}                                    
        </td>
    {/if}
{/store_telephone_data}

2 Answers 2

3

There is no no_result variable or condition for grid. Use total_rows instead.

{if store_telephone_data:total_rows >= 1}
    ...
{if:else}
    <td>N/A</td>
    <td>N/A</td>
{/if}
0
0

The grid field doesn't provide a no_results tag. If you are using search filters on the grid field total_rows will amount to a blank value due to the filters evaluating to true. There is an answer to a possible workaround but I see it as messy and either grid need to update their code or a small developed plugin could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.