ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Grid variable for no_results

October 22, 2013 10:17pm

Subscribe [3]
  • #1 / Oct 22, 2013 10:17pm

    Mercutio

    1 posts

    I’ve been putting together an application that uses Grid inside of Channel:Form and I’ve come up against a unique problem.

    The Grid tag pair does not seem to have an equivalent of channel:entries’ {if_no_results} tag. 

    This is problematic when doing a form-based application that uses a custom template and not just {field:myGridField} to have EE create the markup. 

    Nothing inside the Grid tag pair will display if there is not at least one row of data, which removes my ability to have an empty input in the template when there is no data originally.

    I’m trying to avoid using the default Grid styling (doesn’t match client design) or some wacky javascript workaround to inject my own markup if EE doesn’t.

    Does anyone know if there is a {if_no_results} equivalent for Grid?  Or where to start looking to extend the fieldtype to include this?  Or a better way to achieve my goal in a template?

    Thanks!

  • #2 / Oct 23, 2013 6:12am

    worfoual

    61 posts

    Maybe this one:
    {if myGridField:total_rows == "0"}

    Francois

  • #3 / Aug 22, 2014 3:27pm

    eigotec

    19 posts

    Sorry, old thread, but the same issue for me. When i {grid_field:count} I only get results for users that have data. For users that don’t have any rows, not even a 0 is produced.

  • #4 / Aug 27, 2014 3:48am

    eigotec

    19 posts

    I have also tried

    {if myGridField:total_rows == ""}

    As I thought the return was null, but this made no difference. Back to square one.

    Any ideas on how to do this? Thanks.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases