Oh I didn't know I could do that. That's perfect! Thanks Edwin.
On Mon, Feb 13, 2017 at 8:59 PM, Edwin Haver <[email protected]> wrote: > Hi Paul, > > You can test if the grid has rows by doing the following > > {{if grid.rows:}} > {{=grid.rows}} > {{else:}} > No records > {{pass}} > > > That should do it I think. > > Regards, Edwin > > On Monday, February 13, 2017 at 7:12:53 PM UTC+4, Paul Ellis wrote: >> >> I want to display something else if the query returns empty. Like some >> instructions and buttons. >> >> I can't find anything in the SQLFORM.grid signature, like an on_empty >> option and haven't found anything in the book or by googling. >> >> As the Add button doesn't fit this situation. I am getting a DIV with the >> text 'No records Found' not an empty grid. >> >> How can I do this without checking the DB for rows before calling the >> grid? This would then be accessing the DB twice when there are rows to be >> displayed which is most of the time. >> > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/oTMg3gLlb3U/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

