How to make every fourth <td> as a new <tr> in a table

  {{#each array_result}}
    {{#if {new_row}}}</tr><tr>{{/if}}

I could accomplish the above but metoer throws an error on </tr><tr>

Plz help

One solution to this would be to stop using tables for layout and just use grid & columns which auto-overflow into the next row. Then you don’t have to mess with this kind of stuff.
The other solution would be to use a helper to output the surrounding tags and decide whether it’s time for a new <tr>. Or probably even better: to structure your array_result return value such that it already returns elements in groups of 4 and then you just have 2 nested each loops.

1 Like